fix(waybar): bar pokes missed the wrapped process — switches never touched the bar

nixpkgs wraps waybar, so the running comm is `.waybar-wrapped`:
`pkill -x waybar` (state-sync restart/SIGUSR2 branches, tz-watch,
updates) matched nothing — a theme switch neither restarted nor reloaded
the bar, which then kept the gtk.css of whatever theme it started under
(the stale workspace-digit colors reported 2026-07-18; companion gtk fix
in the next commit). The unanchored pokes (recording, airplane,
theme-shot) had the opposite bug: `waybar` substring-matches the
supervisor's `nomarchy-waybar` comm too, and an unhandled RTMIN
terminates its bash — the pokes were killing the crash guard. All seven
sites now use `pkill … -x 'waybar|\.waybar-wrapped'`.
state-sync 0.5.1 → 0.5.2.

Verified live on Newton (V3-grade): new pattern restarts the bar under
the supervisor (fresh pid, supervisor alive); RTMIN+10 poke reaches the
bar, supervisor survives. V0 `nix flake check --no-build` + py_compile;
V1 HM generation + system toplevel build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 11:04:08 +01:00
parent f658b0087e
commit 76941c55b7
8 changed files with 29 additions and 11 deletions

View File

@@ -447,14 +447,23 @@ def run_switch() -> None:
# reload_style_on_change while the symlinks flip), so prefer the
# restart whenever the supervisor is there to catch it; fall back to
# SIGUSR2 for unsupervised/custom bars. No-ops if nothing is running.
# The pattern matches both comm names: nixpkgs wraps the binary, so
# the process is `.waybar-wrapped` — a bare `pkill -x waybar` matched
# nothing, theme switches never touched the bar, and it kept the
# gtk.css of whatever theme it was started under (the 2026-07-19
# stale-digit-color bug). Keep -x: unanchored `waybar` also matches
# the supervisor's own `nomarchy-waybar` comm and would kill it.
if shutil.which("pkill"):
supervised = subprocess.run(
["pgrep", "-f", "nomarchy-waybar"], capture_output=True
).returncode == 0
if supervised:
subprocess.run(["pkill", "-x", "waybar"], check=False)
subprocess.run(["pkill", "-x", r"waybar|\.waybar-wrapped"], check=False)
else:
subprocess.run(["pkill", "--signal", "SIGUSR2", "-x", "waybar"], check=False)
subprocess.run(
["pkill", "--signal", "SIGUSR2", "-x", r"waybar|\.waybar-wrapped"],
check=False,
)
# ─── Theme assets (wallpapers) ────────────────────────────────────────────