aboutsummaryrefslogtreecommitdiff
path: root/.config/polybar/player-mpris-simple.sh
blob: 938ac21835372f5e5b9a5016ae7c5333d829c04c (plain)
1
2
3
4
5
6
7
8
9
#!/bin/sh

player_status=$(playerctl status 2> /dev/null)

if [ "$player_status" = "Playing" ] || [ "$player_status" = "Paused" ]; then
    echo "$(playerctl metadata artist) - $(playerctl metadata title)" | awk -v len=60 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }'
else
    echo ""
fi