From ad7c4f42e70c689a8810e2f692e0e48c3159a411 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 17 Oct 2025 00:26:09 +1100 Subject: [PATCH] sketchybar: only get playing music if Music.app is open fixes bug where music would keep on starting itself up --- stow/.config/sketchybar/plugins/music.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stow/.config/sketchybar/plugins/music.sh b/stow/.config/sketchybar/plugins/music.sh index d4a0f4b..664b84f 100755 --- a/stow/.config/sketchybar/plugins/music.sh +++ b/stow/.config/sketchybar/plugins/music.sh @@ -1,7 +1,10 @@ #!/bin/sh # sketchybar doesn't like it when the line doesn't end with a carriage return -SONG="$(osascript -e 'tell application "Music" to if player state is playing then artist of current track & " - " & name of current track')" + +if pgrep "Music"; then + SONG="$(osascript -e 'tell application "Music" to if player state is playing then artist of current track & " - " & name of current track')" +fi if [[ "$(echo $SONG | wc -w | sed 's/ //g')" != "0" ]]; then sketchybar --set "$NAME" label="${SONG}" drawing=true