fix(sketchybar): music plugin - fall back to artist name

This commit is contained in:
winston 2022-07-31 20:07:48 +02:00
parent 06f3d3f64d
commit ef66995337
Signed by: winston
GPG key ID: 3786770EDBC2B481

View file

@ -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 "") 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 "") 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 if [ "$STATE" = "playing" ]; then
ICON="" ICON=""
LABEL="$ARTIST - $TRACK" LABEL="$ARTIST - $TRACK"