mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
* UPDATE: select background method * ADD: migration file for background selector * Add symlink for background selector in walker-elephant.sh Forgot about this file. Should be added to make sure the background selector feature available in the fresh install * clean up the code a bit Updated omarchy background selector to hide from provider list and removed subtext from entries. * Make the background selector the default * Fix migration * FIX: typo on background symlink target * UPDATE: add ~/.config/omarchy/backgrounds/theme.name * UPDATE: Cache = false * Fix escaping for all extensions * Extract omarchy-theme-bg-set --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
57 lines
1.5 KiB
Lua
57 lines
1.5 KiB
Lua
Name = "omarchyBackgroundSelector"
|
|
NamePretty = "Omarchy Background Selector"
|
|
Cache = false
|
|
HideFromProviderlist = true
|
|
SearchName = true
|
|
|
|
function GetEntries()
|
|
local entries = {}
|
|
local home = os.getenv("HOME")
|
|
|
|
-- Read current theme name
|
|
local theme_name_file = io.open(home .. "/.config/omarchy/current/theme.name", "r")
|
|
local theme_name = theme_name_file and theme_name_file:read("*l") or nil
|
|
if theme_name_file then
|
|
theme_name_file:close()
|
|
end
|
|
|
|
-- Directories to search
|
|
local dirs = {
|
|
home .. "/.config/omarchy/current/theme/backgrounds",
|
|
}
|
|
if theme_name then
|
|
table.insert(dirs, home .. "/.config/omarchy/backgrounds/" .. theme_name)
|
|
end
|
|
|
|
-- Track added files to avoid duplicates
|
|
local seen = {}
|
|
|
|
for _, wallpaper_dir in ipairs(dirs) do
|
|
local handle = io.popen(
|
|
"find '"
|
|
.. wallpaper_dir
|
|
.. "' -maxdepth 1 -type f \\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' \\) 2>/dev/null"
|
|
)
|
|
if handle then
|
|
for background in handle:lines() do
|
|
local filename = background:match("([^/]+)$")
|
|
if filename and not seen[filename] then
|
|
seen[filename] = true
|
|
table.insert(entries, {
|
|
Text = filename,
|
|
Value = background,
|
|
Actions = {
|
|
activate = "omarchy-theme-bg-set '" .. background .. "'",
|
|
},
|
|
Preview = background,
|
|
PreviewType = "file",
|
|
})
|
|
end
|
|
end
|
|
handle:close()
|
|
end
|
|
end
|
|
|
|
return entries
|
|
end
|