.dotfiles/.config/polybar/scripts/player-mpris-simple.sh

14 lines
444 B
Bash
Raw Normal View History

2023-01-03 01:15:35 +00:00
#!/usr/bin/env sh
2022-03-02 15:58:03 +00:00
2023-01-03 01:15:35 +00:00
playerctl="playerctl -p spotifyd"
2022-03-02 15:58:03 +00:00
2023-01-03 01:15:35 +00:00
player_status=$($playerctl status 2> /dev/null)
2022-03-02 15:58:03 +00:00
if [ "$player_status" = "Playing" ]; then
2023-01-03 01:15:35 +00:00
echo "$($playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
2022-03-02 15:58:03 +00:00
elif [ "$player_status" = "Paused" ]; then
2023-01-03 01:15:35 +00:00
echo "$($playerctl metadata -f '{{title}} - {{artist}} | {{duration(position)}}/{{duration(mpris:length)}}')"
2022-03-02 15:58:03 +00:00
else
echo ""
fi