From cd2f3a0bf7ef92c46cec14178273ed43cae2bc94 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 12 Jul 2024 15:04:29 +0800 Subject: changed music detection and pause play mechanics --- idle.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/idle.sh b/idle.sh index 2de0162..78b6b3c 100755 --- a/idle.sh +++ b/idle.sh @@ -53,11 +53,13 @@ function idle() { notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" fi script -c "$HOME/scripts/update.sh" /var/log/sysupdate.log -a --force - if [ $pmusic ] && [[ $(NekoMC --status) == "Playing" ]]; then - m=true + if [ $pmusic ]; then + if [[ $(playerctl status -p spotify) == "Playing" ]]; then + m=true + fi fi - if [ $pmusic ] && [ "$m" ]; then - NekoMC --pause & + if [ $pmusic ]; then + playerctl --all-players pause fi # re-cache neofetch # script -c "$HOME/scripts/neofetchCache.sh" "$HOME"/scripts/logs/neofetchCache.log -a --force @@ -92,7 +94,7 @@ function stopidle() { /sbin/killall update.sh yay & unfreezeapp & if [ $pmusic ] && [ "$m" ]; then - NekoMC --play & + playerctl play -p spotify unset m fi /sbin/echo "Removing lock file" -- cgit v1.2.3