Skip to content

Stop re-sampling the wallpaper for the transparent bar on unrelated state writes (4.5) - #16799

Merged
dhh merged 1 commit into
v4-5-0from
backport/v4-5-0-bar-relink-only
Oct 27, 2026
Merged

dhh merged 1 commit into
v4-5-0from
backport/v4-5-0-bar-relink-only

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

Backports #8307 to 4.5. It merged to quattro after v4-5-0 was cut. With a transparent bar, 4.5 re-runs the wallpaper sample on every write any plugin makes under ~/.local/state/omarchy, because the bar's watch on current also fires for its parent directory. This moves the watch to current/theme, so only a theme or background swap re-samples. Clean cherry-pick of its squash commit, on top of the #14281 backport already in 4.5.

🤖 Generated by Opus 5.5 in Claude Code.

…tate writes (#8307)

* Stop re-sampling the wallpaper for the transparent bar on unrelated state writes

The bar watched ~/.local/state/omarchy/current for background changes. A
directory path never sits in QFileSystemWatcher's file set, so Quickshell's
FileView re-emitted fileChanged for every entry created, renamed or removed
in ~/.local/state/omarchy as well. Any plugin writing there atomically
(tmp + rename) re-ran omarchy-bar-text-color, and on a 5K display that
ImageMagick pass cost ~2.6 core-seconds across every thread. One plugin
saving every 10 s held ~40% of a core for the whole session, invisible in
quickshell's own CPU figure because magick is a reaped grandchild.

Watching the symlink directly does not work: inotify follows it to the old
image and ln -nsf never touches that inode. Keep the directory watch, resolve
the link with readlink -f and only refresh when the wallpaper actually moved.

Sample at a reduced scale in omarchy-bar-text-color too. The strip is
averaged to one pixel, so shrink the geometry by an integer factor (never
upscale) and let the JPEG decoder skip the detail: 2.58 -> 0.065
core-seconds per sample on a 2912x1632 JPEG at 5120x2160, same result.

* Resolve the background link at startup and cover the watcher in the runtime smoke test

FileView reports no change for its initial load, so without a baseline the
first unrelated write in the state directory still compared against "" and
sampled once. Run the probe when the bar starts.

The smoke test now stubs omarchy-bar-text-color and counts calls in the
running shell: turning transparency on samples once, an atomic write of an
unrelated file in ~/.local/state/omarchy does not sample again, and
repointing current/background does. Against the previous Bar.qml the
unrelated write registers as a second sample and the test fails.

* Drop the reduced-scale helper tests, which #14281 covers

The merge took quattro's omarchy-bar-text-color, whose 1920px canvas, JPEG size hint and resource caps from #14281 already bound the sample this branch shrank, so its tests for the old downscale go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Watch inside current/ so unrelated state writes do not re-sample the bar

FileView watches its path's parent directory too, and re-emits fileChanged for every entry created, renamed or removed there whenever the path itself is not a watched file. Watching ~/.local/state/omarchy/current made that parent ~/.local/state/omarchy, which plugins write to constantly, so the transparent bar re-ran ImageMagick on every unrelated save. Watching current/theme moves the parent to current/, where omarchy-theme-set swaps the theme and omarchy-theme-bg-set repoints the background link, and both still arrive. This replaces a readlink probe that resolved the link on every event: no extra process, and a theme switch that lands on a same-named background still re-samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>

---------

Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Omarchybot <omabot@omarchy.org>
Co-authored-by: Codex Medium <noreply@openai.com>
(cherry picked from commit bc220e7)
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Moves the transparent bar’s wallpaper watch from current to current/theme, avoiding refreshes when plugins write unrelated state.

  • The transparent bar skips wallpaper samples after unrelated state writes.

Reviews (1) · Last reviewed commit: "Stop re-sampling the wallpaper for the t..." · Reviewed by Greptile

@dhh
dhh merged commit 5978d93 into v4-5-0 Oct 27, 2026
2 checks passed
@dhh
dhh deleted the backport/v4-5-0-bar-relink-only branch October 27, 2026 13:58
@emirb emirb added this to the 4.5 milestone Nov 5, 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.

4 participants