skeledance/plugin/contents/ui/cava-start.sh
ltadeu6 d0f72716c2
Fix duplicate CAVA instances via lockfile
pkill pattern was wrong (path has dancingcharacter not skeledance).
Now uses a lockfile to prevent QML from spawning multiple instances.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 09:43:40 -03:00

16 lines
392 B
Bash
Executable file

#!/usr/bin/env bash
LOCK=/tmp/skeledance_cava.lock
# Prevent multiple instances
if [ -f "$LOCK" ] && kill -0 "$(cat "$LOCK")" 2>/dev/null; then
exit 0
fi
echo $$ > "$LOCK"
trap 'rm -f "$LOCK"' EXIT
pkill -x cava 2>/dev/null
pkill -f cava-server 2>/dev/null
sleep 0.2
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cava -p "$DIR/cava.conf" | python3 "$DIR/cava-server.py"