stop all when the soundboard is stopped
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
STATE="$HOME/.soundboard"
|
STATE="$HOME/.soundboard"
|
||||||
|
|
||||||
[[ -f "$STATE/playing.pids" ]] || exit 0
|
if [[ -f "$STATE/playing.pids" ]]; then
|
||||||
|
|
||||||
while read -r PID; do
|
while read -r PID; do
|
||||||
# Check if process exists before sending SIGINT
|
# Check if process exists before sending SIGINT
|
||||||
if [[ -n "$PID" ]] && kill -0 "$PID" 2>/dev/null; then
|
if [[ -n "$PID" ]] && kill -0 "$PID" 2>/dev/null; then
|
||||||
@@ -15,3 +14,4 @@ done < "$STATE/playing.pids"
|
|||||||
rm -f "$STATE/playing.pids"
|
rm -f "$STATE/playing.pids"
|
||||||
|
|
||||||
echo "All soundboard playback stopped."
|
echo "All soundboard playback stopped."
|
||||||
|
fi
|
||||||
|
|||||||
@@ -2,19 +2,9 @@
|
|||||||
|
|
||||||
STATE="$HOME/.soundboard"
|
STATE="$HOME/.soundboard"
|
||||||
|
|
||||||
[[ -f "$STATE/playing.pids" ]] || exit 0
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
while read -r PID; do
|
$SCRIPT_DIR/stop_all.sh
|
||||||
# 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
|
# 2. Restore default mic BEFORE unloading modules
|
||||||
DEFAULT_MIC=$(pactl info | grep "Default Source" | awk '{print $3}')
|
DEFAULT_MIC=$(pactl info | grep "Default Source" | awk '{print $3}')
|
||||||
|
|||||||
Reference in New Issue
Block a user