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

13 lines
514 B
Bash
Executable file

#!/bin/sh
big="\033[11m"
reset="\033[10m"
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
[ "$(playerctl status 2>&1)" = "No players found" ] && echo "$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="$big$(playerctl status | sed "s/Playing//;s/Paused//;")$reset"
echo "$icon $song"