diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-02-04 14:59:37 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2026-02-04 14:59:37 -0500 |
| commit | 68a7844037c52fabe3317e63e8d6c17213f9ae2d (patch) | |
| tree | 3f4836408d5c95b94ae9df1b180157c286b7b026 /config/hypr | |
| parent | 6c3cdeba7eae38c6273a2ba5c3b9f2c319d5c102 (diff) | |
waybar-cava processes getting started on every waybar config change
These changes kill those processes
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: config/hypr/scripts/Refresh.sh
modified: config/hypr/scripts/WaybarCava.sh
Diffstat (limited to 'config/hypr')
| -rwxr-xr-x | config/hypr/scripts/Refresh.sh | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarCava.sh | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 76757aa4..b998b14c 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -22,6 +22,9 @@ for _prs in "${_ps[@]}"; do fi done +# Clean up any Waybar-spawned cava instances (unique temp conf names) +pkill -f 'waybar-cava\..*\.conf' 2>/dev/null || true + # added since wallust sometimes not applying killall -SIGUSR2 waybar # Added sleep for GameMode causing multiple waybar diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh index 6809e60e..98a8d7f9 100755 --- a/config/hypr/scripts/WaybarCava.sh +++ b/config/hypr/scripts/WaybarCava.sh @@ -10,6 +10,9 @@ if ! command -v cava >/dev/null 2>&1; then exit 1 fi +# Proactively reap any stale Waybar-spawned cava (unique temp conf names) +pkill -f 'waybar-cava\..*\.conf' 2>/dev/null || true + # 0..7 → ▁▂▃▄▅▆▇█ bar="▁▂▃▄▅▆▇█" dict="s/;//g" @@ -32,7 +35,11 @@ printf '%d' $$ >"$pidfile" # Unique temp config + cleanup on exit config_file="$(mktemp "$RUNTIME_DIR/waybar-cava.XXXXXX.conf")" -cleanup() { rm -f "$config_file" "$pidfile"; } +cleanup() { + # Kill children (cava, sed) of this script, then remove files + pkill -P "$$" 2>/dev/null || true + rm -f "$config_file" "$pidfile" +} trap cleanup EXIT INT TERM cat >"$config_file" <<EOF @@ -52,4 +59,5 @@ ascii_max_range = 7 EOF # Stream cava output and translate digits 0..7 to bar glyphs -exec cava -p "$config_file" | sed -u "$dict" +# (no exec: keep this shell as the parent so the trap can reap children) +cava -p "$config_file" | sed -u "$dict" |
