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>
This commit is contained in:
ltadeu6 2026-06-07 09:43:40 -03:00
parent 39e7c07309
commit d0f72716c2
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D

View file

@ -1,6 +1,15 @@
#!/usr/bin/env bash
pkill -f "cava -p.*skeledance" 2>/dev/null
pkill -f "cava-server.py" 2>/dev/null
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)"