fix: resolve a wallpaper the way omarchy resolves one - #5
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3, from a code-review finding on macarchy/macarchy-install#10.
The bug
resolve_imagelooked in exactly one place:~/.config/omarchy/backgrounds/<theme>/is populated only byomarchy 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:
~/.config/omarchy/backgrounds/<theme>/~/.local/state/omarchy/current/theme/backgrounds/omarchy theme set~/.config/omarchy/themes/<theme>/backgrounds/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:78andomarchy-theme-bg-next:12find -Lboth directory 1 and directory 2 andsortthem as a single list. Every copied file would then appear twice inomarchy theme bg nextand twice in the switcher's thumbnails — and because.configsorts before.localand1-before11-,backgrounds[0]would flip, changing which wallpaper a freshomarchy theme set apple-glasspicks. 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