Some checks failed
Check / eval-and-lint (push) Failing after 6m40s
Pillar 9 VM test: the walker theme picker (and background selector) returned "No Results". Root cause: nomarchy_themes.lua and nomarchy_background_selector.lua (elephant lua menu providers named "nomarchythemes" / "nomarchyBackgroundSelector") were deployed via the bulk nomarchy config to ~/.config/nomarchy/default/elephant/ — outside elephant's provider search path, so elephant never registered them and `nomarchy-launch-walker -m menus:nomarchythemes` (used by nomarchy-theme, nomarchy-wallpaper, and nomarchy-menu Style submenu) had no backing menu. Move them into the elephant config (features/apps/elephant/config/menus/) so they deploy to ~/.config/elephant/menus/. Verified on a fresh VM boot: `elephant listproviders` now lists menus:nomarchythemes + menus:nomarchyBackgroundSelector, and the walker theme picker renders all 21 palettes with per-theme preview images. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
74 lines
2.0 KiB
Lua
74 lines
2.0 KiB
Lua
Name = "nomarchyBackgroundSelector"
|
|
NamePretty = "Nomarchy Background Selector"
|
|
Cache = false
|
|
HideFromProviderlist = true
|
|
SearchName = true
|
|
|
|
local function ShellEscape(s)
|
|
return "'" .. s:gsub("'", "'\\''") .. "'"
|
|
end
|
|
|
|
function FormatName(filename)
|
|
-- Remove leading number and dash
|
|
local name = filename:gsub("^%d+", ""):gsub("^%-", "")
|
|
-- Remove extension
|
|
name = name:gsub("%.[^%.]+$", "")
|
|
-- Replace dashes with spaces
|
|
name = name:gsub("-", " ")
|
|
-- Capitalize each word
|
|
name = name:gsub("%S+", function(word)
|
|
return word:sub(1, 1):upper() .. word:sub(2):lower()
|
|
end)
|
|
return name
|
|
end
|
|
|
|
function GetEntries()
|
|
local entries = {}
|
|
local home = os.getenv("HOME")
|
|
|
|
-- Read current theme name
|
|
local theme_name_file = io.open(home .. "/.config/nomarchy/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/nomarchy/current/theme/backgrounds",
|
|
}
|
|
if theme_name then
|
|
table.insert(dirs, home .. "/.config/nomarchy/backgrounds/" .. theme_name)
|
|
end
|
|
|
|
-- Track added files to avoid duplicates
|
|
local seen = {}
|
|
|
|
for _, wallpaper_dir in ipairs(dirs) do
|
|
local handle = io.popen(
|
|
"find " .. ShellEscape(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 | sort"
|
|
)
|
|
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 = FormatName(filename),
|
|
Value = background,
|
|
Actions = {
|
|
activate = "nomarchy-theme-bg-set " .. ShellEscape(background),
|
|
},
|
|
Preview = background,
|
|
PreviewType = "file",
|
|
})
|
|
end
|
|
end
|
|
handle:close()
|
|
end
|
|
end
|
|
|
|
return entries
|
|
end
|