From ef6699533729fdea895f89e73675ba932706e667 Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 31 Jul 2022 20:07:48 +0200 Subject: [PATCH] fix(sketchybar): music plugin - fall back to artist name --- dot_config/sketchybar/plugins/executable_music.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dot_config/sketchybar/plugins/executable_music.sh b/dot_config/sketchybar/plugins/executable_music.sh index 4acdc3e..1dcc961 100644 --- a/dot_config/sketchybar/plugins/executable_music.sh +++ b/dot_config/sketchybar/plugins/executable_music.sh @@ -5,6 +5,11 @@ if pgrep -xq Music; then TRACK=$(osascript -e 'tell application "Music" to name of current track as string' 2>/dev/null || echo "") ARTIST=$(osascript -e 'tell application "Music" to album artist of current track as string' 2>/dev/null || echo "") + # fall back to artist, if album artist is unavailable, or generic + if [ "$ARTIST" = "" ] || [ "$ARTIST" = "Various Artists" ]; then + ARTIST=$(osascript -e 'tell application "Music" to artist of current track as string' 2>/dev/null || echo "") + fi + if [ "$STATE" = "playing" ]; then ICON="" LABEL="$ARTIST - $TRACK"