fix(home): match wrapped waybar comm when killing bar on monitor change
`pkill -x waybar` matched only comm `waybar`, but the home-manager wrapper launches the bar with comm `.waybar-wrapped` (arg[0] still `waybar`), so the kill missed and left a stale bar drawing on the old geometry after an unplug. Match both comms via an anchored ERE in both the `monitor-hotplug` handler and `swapMonitors`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -115,8 +115,11 @@ let
|
||||
| "keyword monitor \($l.name),preferred,0x0,\($l.scale)"
|
||||
+ " ; keyword monitor \($r.name),preferred,\($off)x0,\($r.scale)"')
|
||||
"$hc" --batch "$cmd"
|
||||
# re-anchor the layer-shell clients onto the new geometry (see comment above)
|
||||
${pkgs.procps}/bin/pkill -USR2 -x .waybar-wrapped || true
|
||||
# re-anchor the layer-shell clients onto the new geometry (see comment above).
|
||||
# Anchored ERE covers both comms: the wrapper-launched bar (comm
|
||||
# `.waybar-wrapped`) and one the monitor-hotplug handler relaunched via
|
||||
# `hyprctl dispatch exec waybar` (comm `waybar`).
|
||||
${pkgs.procps}/bin/pkill -USR2 -x '\.waybar-wrapped|waybar' || true
|
||||
bg="$HOME/.local/share/bg"
|
||||
[ -e "$bg" ] && ${pkgs.awww}/bin/awww img "$bg" || true
|
||||
'';
|
||||
|
||||
+7
-3
@@ -40,10 +40,14 @@ let
|
||||
"monitoradded>>"* | "monitorremoved>>"*)
|
||||
sleep 1 # let Hyprland settle the new geometry
|
||||
setbg # re-push wallpaper to all current outputs
|
||||
${pkgs.procps}/bin/pkill -x waybar || true # relaunch waybar fresh (see comment)
|
||||
# Anchored ERE matching `comm` (max 15 chars): the bar launched via the
|
||||
# home-manager wrapper reports comm `.waybar-wrapped` (arg[0] is still
|
||||
# `waybar`), so a bare `-x waybar` never matches it and leaves a stale bar.
|
||||
wb='\.waybar-wrapped|waybar'
|
||||
${pkgs.procps}/bin/pkill -x "$wb" || true # relaunch waybar fresh (see comment)
|
||||
i=0
|
||||
while [ $i -lt 6 ] && ${pkgs.procps}/bin/pgrep -x waybar >/dev/null; do sleep 0.3; i=$((i+1)); done
|
||||
${pkgs.procps}/bin/pkill -9 -x waybar || true
|
||||
while [ $i -lt 6 ] && ${pkgs.procps}/bin/pgrep -x "$wb" >/dev/null; do sleep 0.3; i=$((i+1)); done
|
||||
${pkgs.procps}/bin/pkill -9 -x "$wb" || true
|
||||
${hyprctl} dispatch exec waybar
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user