Repository navigation
Conversation
|
b25e19a to
039b4cf
Compare
039b4cf to
c509d0f
Compare
8c39e01 to
d2a6a9e
Compare
8ac5007 to
8e62eb1
Compare
8e62eb1 to
69e917f
Compare
| [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} && -S $socket ]] || return 0 | ||
| HYPRLAND_RELOADS=$(mktemp "${XDG_RUNTIME_DIR:-/tmp}/omarchy-theme-set-reloads.XXXXXX") || return 0 | ||
| { | ||
| timeout 3 socat -u "UNIX-CONNECT:$socket" - | |
There was a problem hiding this comment.
Listener stops before the swap
timeout 3 starts before template rendering and the intro-cover wait. That wait alone can take about three seconds, and user templates add more time. If these steps outlast the listener, Hyprland's reload after the swap is never recorded. The switch then reloads again despite a successful watch reload, adding the compositor pause this PR aims to remove.
Keep the listener alive through the swap and the following reload-check window.
There was a problem hiding this comment.
Fixed in f405d0c: the listener now runs for 10s, past the intro cover wait (3s cap) and the templates.
d77fd25 to
2bd2d22
Compare
|
Live results at head 2bd2d22, with #15190 and #15191 merged in. Each switch reloaded Hyprland once:
The background steps finished every time: icon theme, Chromium policy colour, Claude theme, and an empty theme-set.log. No listener or event file was left behind. A run of 6 traced switches before the last change also had one reload each. In one earlier untraced run (4 switches), one switch reloaded twice. The listener now starts right after the selection lock, well before the swap, which should make that fallback rare. 🤖 Generated with Claude Code |
Hyprland already reloads when the swap replaces the hyprland.lua it loaded, so the explicit reload repeated a ~20ms compositor stall mid-transition. - Swap the theme in with one rename (mv --exchange), so there is never a moment without a current theme for a reload to fall into. - Record Hyprland's events from before the swap and reload explicitly only when no configreloaded follows it within 500ms, or when the swap could not be one rename. - Settle that while holding the selection lock, so one switch's reload can't pass for the next one's, while the terminals already retint. - Count microseconds from EPOCHREALTIME's digits alone, which comma locales write with a comma. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2bd2d22 to
2fe66a1
Compare
|
Closing: saves at most one ~20ms compositor stall per switch, not worth the added listener/lock/timeout machinery in omarchy-theme-set. The main theme-switch win landed in #15189. |
Stacked on #15189. Only the last commit ("Leave the theme's Hyprland reload to Hyprland's own config watch") is this PR. Merge #15189 first. This branch was squashed to that one commit while it absorbed review fixes.
What changed
Hyprland watches the config files it loaded, the theme's
hyprland.luaamong them. Whenomarchy-theme-setreplacescurrent/theme, Hyprland reloads by itself. Countingconfigreloadedevents on the event socket during live switches, quattro reloads two or three times per switch: Hyprland's own reload at the swap, thenomarchy-restart-hyprctlfrom the retints, and sometimes one more. Eachhyprctl reloadstalls the compositor ~20ms, in the middle of the bar and wallpaper transition.omarchy-theme-setnow swaps the staged theme in withmv --exchange -Tand only then removes the old one. The oldrm -rf current; mv next currentleft a moment with no current theme. A reload landing in that gap would skip the theme (require_optional) and drop it from the watch. The fallback for a first theme, or anmvwithout--exchange, keeps the old two steps.timeout 10 socatappends Hyprland's event stream (.socket2.sock) to a temp file it opens once.configreloadedlines so far.reload_hyprland_unless_watchedskips the explicit reload only if a new one appears after the exchange, waiting at most 500ms for it.omarchy-hyprland-reload-guard(checked first, so there is no wait), a missed or absent watch, and the non-atomic fallback swap, which is never trusted.timeout.$EPOCHREALTIMEuses the locale's decimal separator (1791832819,402790under da_DK, de_DE or fr_FR), so the 500ms deadline reads only its digits (${EPOCHREALTIME//[!0-9]/}). Event order no longer depends on timestamps at all.Earlier versions of this PR first guessed from the outgoing files whether the watch would fire, then compared read timestamps. Review found cases where each went wrong: symlinks, hard links, open files, delayed events from the previous switch, and comma locales. The current design counts events and settles them under the lock.
Measurements
These are live
configreloadedevents, in ms after the command started:On every switch with this PR there is one reload, and the border changes with it. That includes the intro switch, where the reload after playback is skipped because the record shows Hyprland reloaded at the swap. Borders change ~44–53ms after a switch to Starship starts, against 51–59ms on quattro.
Tests
theme-set-retint-order-test.shserves a stand-in for Hyprland's event socket and covers these behaviours:localedef(skipped where it can't be built), the switch's microsecond clock reads digits only and a full switch completes.New
theme-swap-test.shchecks that a currenthyprland.luaexists at every rename. The exchange-specific cases skip withoutmv --exchange. I mutation-checked each fix: a dot-only clock, terminals after the reload, a listener left running, counting after the exchange, never or always trusting the event, and settling outside the lock.What a human should check
Switch themes with the picker and confirm the window borders follow every time. A missed watch now costs up to 500ms before the fallback reload, though the terminals no longer wait for it.
Not changed: after an intro, the reload still runs in the detached playback subshell, as on quattro.
OMARCHY_THEME_WAIT=1doesn't join it, and a failure there isn't reported. Joining it would hold the command for the whole clip.🤖 Generated with Claude Code