dots/stow/.config/sketchybar/plugins/music.sh

10 lines
465 B
Bash
Executable file

#!/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 [[ "$(echo $SONG | wc -w | sed 's/ //g')" != "0" ]]; then
sketchybar --set "$NAME" label="${SONG}" background.drawing=true icon.drawing=true
else
sketchybar --set "$NAME" label="" background.drawing=false icon.drawing=false
fi