Skip to content

fix: resolve a wallpaper the way omarchy resolves one - #5

Merged
phmatray merged 1 commit into
mainfrom
fix/resolve-a-wallpaper-the-way-omarchy-does
Sep 4, 2026
Merged

fix: resolve a wallpaper the way omarchy resolves one#5
phmatray merged 1 commit into
mainfrom
fix/resolve-a-wallpaper-the-way-omarchy-does

Conversation

@phmatray

@phmatray phmatray commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #3, from a code-review finding on macarchy/macarchy-install#10.

The bug

resolve_image looked in exactly one place:

path = BACKGROUNDS_ROOT / cfg.get("theme", "") / mapping[phase]

~/.config/omarchy/backgrounds/<theme>/ is populated only by omarchy theme set. Before the first theme apply — and on any machine without omarchy, which is every CI runner — the theme's own wallpapers are nowhere the tool can see them, so its unit fails on every tick. That is the remaining half of macarchy/macarchy-install#9.

The fix, and the one that was withdrawn

It now walks the same directories omarchy itself does, in omarchy's own order, plus one tail:

# directory who fills it
1 ~/.config/omarchy/backgrounds/<theme>/ the user
2 ~/.local/state/omarchy/current/theme/backgrounds/ omarchy theme set
3 ~/.config/omarchy/themes/<theme>/backgrounds/ installing the theme

1 and 2 are omarchy-theme-bg-next:7-8. 3 is the tail that makes a fresh machine work.

The first attempt copied the theme's wallpapers into directory 1 at install time, and it was wrong. omarchy-theme-set:78 and omarchy-theme-bg-next:12 find -L both directory 1 and directory 2 and sort them as a single list. Every copied file would then appear twice in omarchy theme bg next and twice in the switcher's thumbnails — and because .config sorts before .local and 1- before 11-, backgrounds[0] would flip, changing which wallpaper a fresh omarchy theme set apple-glass picks. Reading one more directory costs nothing and duplicates nothing.

Test

Four cases: the user directory still wins; the installed theme is used before any theme has been applied (the fresh-machine case CI reproduces); the applied theme outranks the installed copy; and a wallpaper missing everywhere names every place it looked instead of just the first. Suite: 35 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SYBhT1xfp3MQ1w3687F4Mp

The tool looked only in ~/.config/omarchy/backgrounds/<theme>/. Nothing
populates that until `omarchy theme set` has run at least once, so on a fresh
machine -- and on every CI runner, which has no omarchy at all -- the theme's own
wallpapers were nowhere it could see them and its unit failed on every tick.
macarchy-install#9.

It now walks the same two directories omarchy-theme-bg-next merges into one
list (the user's own, then the applied theme's), and then the installed-theme
directory, which holds the same files before any theme has been applied.

The obvious alternative -- copy the theme's wallpapers into the first directory
at install time -- was implemented first and withdrawn: omarchy-theme-set:78 and
omarchy-theme-bg-next:12 `find` BOTH directories and `sort` them as one list, so
every copied file would appear twice in `omarchy theme bg next` and twice in the
switcher's thumbnails, and `.config` sorting before `.local` would have changed
which wallpaper a fresh `omarchy theme set apple-glass` picks. Reading one more
directory costs nothing and duplicates nothing.

A wallpaper missing from all three now names all three rather than just the one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYBhT1xfp3MQ1w3687F4Mp
@phmatray
phmatray merged commit 1efaa51 into main Sep 4, 2026
1 check passed
@phmatray
phmatray deleted the fix/resolve-a-wallpaper-the-way-omarchy-does branch September 4, 2026 22:47
@github-actions github-actions Bot mentioned this pull request Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant