From 5a1ec0958c698baceda6459f2f455d38b681d731 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 24 Feb 2026 17:00:35 +0800 Subject: bump --- audio-autoAdjust.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'audio-autoAdjust.sh') diff --git a/audio-autoAdjust.sh b/audio-autoAdjust.sh index 398cf68..4036b9a 100755 --- a/audio-autoAdjust.sh +++ b/audio-autoAdjust.sh @@ -33,25 +33,29 @@ if [ "$1" ]; then /sbin/echo -e "Usage: $0 [OPTION]\n\nOptions:\n\t-l|--lower\tTo lower music volume\n\t-n|--normal\tTo set music volume to normal" exit 0 elif [[ "$1" == '--daemon' || "$1" == '-d' ]]; then + while true; do + if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then + break + fi + sleep 1 + done while true; do - if [[ "$(systemctl is-system-running)" == "running" || "$(systemctl is-system-running)" == "degraded" ]]; then - if [[ $(playerctl status -p firefox) == "Playing" ]]; then - if [ $STATE -eq 0 ]; then - STATE=1 - echo VideoDetected - lower_music - fi - elif [[ $(playerctl status -p spotify) == "Playing" ]]; then - if [ $STATE -eq 1 ]; then - STATE=0 - echo VideoGone - normal_music - fi - else - sleep 5 - fi - sleep 1 - fi + if [[ $(playerctl status -p firefox) == "Playing" ]]; then + if [ $STATE -eq 0 ]; then + STATE=1 + echo VideoDetected + lower_music + fi + elif [[ $(playerctl status -p spotify) == "Playing" ]]; then + if [ $STATE -eq 1 ]; then + STATE=0 + echo VideoGone + normal_music + fi + else + sleep 5 + fi + sleep 1 done exit 0 elif [[ "$1" == '--lower' || "$1" == '-l' ]]; then -- cgit v1.2.3