Load wallpapers.json at startup, not only when it is next written - #2
Open
FizykPSX wants to merge 2 commits into
Open
Load wallpapers.json at startup, not only when it is next written#2FizykPSX wants to merge 2 commits into
FizykPSX wants to merge 2 commits into
Conversation
The service starts its config reader from onPluginDirChanged, because pluginDir is only known once the shell has injected the manifest. That handler runs before the Process's own command binding has been re-evaluated, so the reader started as ["true"]: it collected nothing, parseConfig ran against an empty string, and every output was left to omarchy.background. Nothing said so. The inotify watcher picked the file up on the next write, which made pinning a wallpaper work and made it look like the config was being honoured -- until the shell was restarted, when every pinned display quietly went back to the theme background. Set the command explicitly at the point the read is started, so it is against configPath rather than against whichever binding pass happened to have run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The handler still called configFile.reload(), the FileView that bounding the config read removed. The call throws, so `omarchy-shell displaywright reload` returned an error rather than "ok", and pick-wallpaper.sh -- which calls it to save the watch latency, and ignores the failure -- was left waiting on inotify for a wallpaper it had just written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
FizykPSX
force-pushed
the
fix-startup-config-read
branch
from
August 30, 2026 20:01
c88e6e1 to
aebe1aa
Compare
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.
What happens
Pinned wallpapers survive a write to
wallpapers.jsonbut not a shell restart. Afteromarchy restart shell, every pinned display goes back to the theme background, while the config file is still on disk and unchanged.omarchy-shell displaywright statusright after a restart:Touching the file (
touch ~/.config/displaywright/wallpapers.json) restores both displays immediately, which is what made this look like a config problem rather than a load-order one.Why
reloadConfig()is called fromonPluginDirChanged, sincepluginDironly becomes known once the shell injects the manifest into the constructed service. That handler runs before thecommandbinding onconfigReaderhas been re-evaluated, so the Process starts with the["true"]placeholder it holds whilepluginDiris empty.truewrites nothing,StdioCollectorhandsparseConfigan empty string, andmonitorSourcesstays empty — no warning anywhere, because an empty config is a legitimate state.The inotify watcher is unaffected, so the next write to the file loads it correctly. That is why picking a wallpaper works and only a restart shows the bug.
Logging the state at the moment the read is started:
The change
First commit sets
configReader.commandexplicitly inreloadConfig(), so the read is againstconfigPathregardless of which binding pass has run.Second commit is a separate bug found next to it: the
displaywrightIPCreload()still callsconfigFile.reload(), theFileViewthatread-config.shreplaced. The call throws, soomarchy-shell displaywright reloadreturns an error instead ofok.pick-wallpaper.shcalls it to save the watch latency and ignores the failure, so nothing visibly broke — but the IPC target is documented and does not work.Testing
node --test tests/*.mjs— 89 pass, 0 failomarchy restart shellruns, each followed byomarchy-shell displaywright statusshowingpinnedfor both outputs. Before the change the same loop reportedthemefor both every time.omarchy-shell displaywright reloadreturnsok.hyprctl layersstill shows thedisplaywrightsurface aboveomarchy-backgroundon both outputs.🤖 Generated with Claude Code