diff --git a/modules/home.nix b/modules/home.nix index 53cb972..29067b0 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -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 ''; diff --git a/modules/media.nix b/modules/media.nix index f2e8870..d96557a 100644 --- a/modules/media.nix +++ b/modules/media.nix @@ -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