dotfiles/.config/waybar/spotify.sh

22 lines
454 B
Bash
Raw Normal View History

#!/usr/bin/bash
MCLASS=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
MICON="🎵"
if [[ $MCLASS == "playing" ]]; then
MINFO=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
if [[ ${#MINFO} > 35 ]];
then
MINFO=$(echo $MINFO | cut -c1-35)"..."
fi
2022-02-25 14:15:40 +00:00
MTEXT=" "$MICON" "$MINFO" "
elif [[ $class == "paused" ]];
then
MTEXT=$MICON" (paused) "
elif [[ $class == "stopped" ]];
then
MTEXT=""
fi
printf "$MTEXT"