1
0
Fork 0
dotfiles/.local/bin/statusbar/sb-playerctl

14 lines
544 B
Plaintext
Raw Normal View History

2023-02-06 10:27:26 +01:00
#!/bin/sh
2023-02-21 17:49:55 +01:00
2023-04-12 11:37:10 +02:00
big="\e[11m"
reset="\e[10m"
2023-02-21 17:49:55 +01:00
2023-02-06 10:27:26 +01:00
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
2023-04-12 11:37:10 +02:00
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "%bﱙ%b" "$big" "$reset" && exit 1
2023-02-06 10:27:26 +01:00
# song="$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
2023-02-09 12:14:40 +01:00
song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)"
2023-02-06 10:27:26 +01:00
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
2023-02-21 17:49:55 +01:00
2023-03-28 09:45:16 +02:00
icon="$(playerctl status | sed "s/Playing//;s/Paused//;s/Stopped/ﱙ/;")"
2023-04-12 11:37:10 +02:00
printf "%b" "$big$icon$reset $song"