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

14 lines
544 B
Bash
Executable File

#!/bin/sh
big="\e[11m"
reset="\e[10m"
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
[ "$(playerctl status 2>&1)" = "No players found" ] && printf "%bﱙ%b" "$big" "$reset" && exit 1
# song="$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
song="$(playerctl metadata xesam:title) - $(playerctl metadata xesam:artist)"
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")"
icon="$(playerctl status | sed "s/Playing//;s/Paused//;s/Stopped/ﱙ/;")"
printf "%b" "$big$icon$reset $song"