Repository navigation
Conversation
With every theme's backgrounds in one carousel the list gets long; --filterable lets you type to narrow it by file name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The image picker keeps one image per file name, so passing every theme's backgrounds folder hid same-named backgrounds (20 stock themes ship an omarchy.png; only the first was selectable). Link every background into one cache folder as <theme>--<file> and open the picker on that instead. The prefix also lets the filter match theme names. Switching theme points the background at the copy staged under current/theme, which matched none of the originals, so the picker highlighted the first image and Enter could change the wallpaper. Map a staged background back to its original theme file before selecting it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A theme name may contain "--", so "<theme>--<file>" could give two backgrounds the same link name (foo--bar/baz.png and foo/bar--baz.png), hiding one and letting the staged-background lookup pick the other. Separate with "@", which installed theme names can't contain, and percent-escape "%" and "@" in the theme part so the first "@" always ends the theme name, whatever a user-made theme is called. Read existing links NUL-separated instead of tab-separated, so a tab in a file name no longer makes the switcher rewrite the link on every open or leave it behind when the background is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| local theme=${1//%/%25} | ||
| REPLY=${theme//@/%40} |
There was a problem hiding this comment.
Theme-name filtering breaks When a user-created theme is named
my@theme or contains %, this escaping changes the name shown to the picker to %40 or %25. The picker filters link names without decoding them, so typing the theme’s actual name finds none of its backgrounds. The labels show the escaped name too, making those themes harder to find.
Summary
omarchy-theme-bg-switcher-all(omarchy theme bg-switcher-all), which opens the existing image picker over the backgrounds of every theme at once (stock themes, user themes, and the per-theme~/.config/omarchy/backgrounds/<theme>/folders), instead of just the current theme.style.background-all("All Backgrounds"), same apply path as the existing background switcher (omarchy-theme-bg-set).SUPER+CTRL+ALT+SPACEnext to the existingSUPER+CTRL+SPACE(current-theme-only) switcher. If you'd rather not add a default bind, the menu entry works on its own and the bind line can be dropped.How it works
ImagePickerModel.loadRows, covered byimage-picker-test.sh), and themes reuse names — 20 stock themes ship anomarchy.png. Passing every theme's folder directly would hide all but one of those. Instead the switcher links each background into~/.cache/omarchy/all-backgrounds/as<theme>@<file>and opens the picker on that folder. The prefix also means typing a theme name in the filter (--filterable) narrows to that theme.@can't appear in installed theme names (omarchy-theme-installallows[a-z0-9._+-]); for user-made themes,%and@in the theme part are percent-escaped, so the first@always ends the theme name and every background gets a distinct link. Existing links are read NUL-separated, so any file name (tabs included) is tracked correctly.omarchy-theme-setstages them), and a theme's own background wins over a same-named one in the user's per-theme folder (as the per-theme switcher does).omarchy-theme-setpointscurrent/backgroundat the copy staged undercurrent/theme/backgrounds/, which is none of the originals. The switcher maps a staged background back to its original theme file by name, so the picker highlights it (it matches the link viafind -L -samefile) and pressing Enter keeps the wallpaper. Selecting returns a link;omarchy-theme-bg-setalreadyrealpaths it, socurrent/backgroundpoints at the original file as before.No changes to
omarchy-menu-images,ImagePickerModel, oromarchy-theme-bg-set.Test plan
test/shell.d/theme-bg-switcher-all-test.sh(12 checks): same-named backgrounds from different themes both appear; user theme beats stock theme; user per-theme backgrounds included; link names can't collide even for theme names containing@/%; picker opens filterable on the link folder; a staged background maps back to its original, and to its own theme when names would otherwise run together; an original background is selected as is; an unchanged view isn't rewritten (tabs in file names included); removed backgrounds lose their link; new backgrounds gain one; non-link files are never removed../test/all— no new failures. The 4 failing files (config,locate,snapper,unowned-system-paths) fail identically without this PR's changes (missing localomarchy-pkgscheckout / local tooling).omarchy theme bg current.hyprctl configerrorsclean after adding the bind.