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

16 lines
464 B
Plaintext
Raw Normal View History

2022-07-04 21:36:33 +02:00
#!/bin/sh
2022-08-07 12:54:35 +02:00
filter() {
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
2022-08-07 12:54:35 +02:00
song=$(mpc current -f "%artist% - %title%" | xargs -0 )
2022-08-11 18:51:42 +02:00
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
2022-08-11 10:20:33 +02:00
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
2022-08-16 00:01:38 +02:00
echo "$icon $song"
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
2022-08-16 00:01:38 +02:00
echo "ﱙ"
2022-08-07 12:54:35 +02:00
else
exit 1
fi
}
2022-07-04 21:36:33 +02:00
pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &