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

16 lines
458 B
Bash
Executable File

#!/bin/sh
filter() {
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
song=$(mpc current -f "%artist% - %title%" | xargs -0)
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")"
mpc | awk 'NR==2' | grep -q playing && icon="󰏤" || icon="󰐊"
echo "$icon $song"
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
echo "󰓛"
else
exit 1
fi
}
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
filter