stop all when the soundboard is stopped

This commit is contained in:
William Bell
2026-01-03 14:49:12 +00:00
parent 9869f6c96e
commit 5694c1ee39

View File

@@ -2,7 +2,19 @@
STATE="$HOME/.soundboard"
exec ./stop_all.sh
[[ -f "$STATE/playing.pids" ]] || exit 0
while read -r PID; do
# Check if process exists before sending SIGINT
if [[ -n "$PID" ]] && kill -0 "$PID" 2>/dev/null; then
kill -INT "$PID" 2>/dev/null || true
fi
done < "$STATE/playing.pids"
# Clear the PID file after attempting to stop everything
rm -f "$STATE/playing.pids"
echo "All soundboard playback stopped."
# 2. Restore default mic BEFORE unloading modules
DEFAULT_MIC=$(pactl info | grep "Default Source" | awk '{print $3}')