mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-30 07:10:22 +00:00
24 lines
828 B
Bash
Executable file
24 lines
828 B
Bash
Executable file
#!/usr/bin/env bash
|
|
RUNNING=$(osascript -e 'if application "Spotify" is running then return 0')
|
|
if [ "$RUNNING" == "" ]; then
|
|
RUNNING=1
|
|
fi
|
|
PLAYING=1
|
|
TRACK=""
|
|
ALBUM=""
|
|
ARTIST=""
|
|
if [ "$(osascript -e 'if application "Spotify" is running then tell application "Spotify" to get player state')" == "playing" ]; then
|
|
PLAYING=0
|
|
TRACK=$(osascript -e 'tell application "Spotify" to get name of current track')
|
|
ARTIST=$(osascript -e 'tell application "Spotify" to get artist of current track')
|
|
ALBUM=$(osascript -e 'tell application "Spotify" to get album of current track')
|
|
fi
|
|
if [ $RUNNING -eq 0 ] && [ $PLAYING -eq 0 ]; then
|
|
if [ "$ARTIST" == "" ]; then
|
|
sketchybar --set $NAME label=" $TRACK $ALBUM"
|
|
else
|
|
sketchybar --set $NAME label=" $TRACK $ARTIST"
|
|
fi
|
|
else
|
|
sketchybar --set $NAME label=""
|
|
fi
|