summaryrefslogtreecommitdiff
path: root/audio-autoAdjust.sh
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-02-24 17:00:35 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-02-24 17:00:35 +0800
commit5a1ec0958c698baceda6459f2f455d38b681d731 (patch)
tree9c7b8aedf6017813e6d44301a694dadd83cc741a /audio-autoAdjust.sh
parent85ce700898392cb92952b9b417de2f1727d5ed0a (diff)
bump
Diffstat (limited to 'audio-autoAdjust.sh')
-rwxr-xr-xaudio-autoAdjust.sh40
1 files changed, 22 insertions, 18 deletions
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