aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/Refresh.sh3
-rwxr-xr-xconfig/hypr/scripts/WaybarCava.sh12
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"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage