dotfiles/.local/bin/statusbar/music

13 lines
394 B
Plaintext
Raw Normal View History

2020-07-04 14:23:27 +02:00
#!/bin/sh
2021-06-12 18:27:40 +02:00
if [ "$( mpc status | grep -c '\[playing\]')" -eq 1 ]; then
full_length="$(mpc status | sed "/^volume:/d" | tac | sed -e "s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/ /g")"
#remove full directory structure if no title present and too long
if [ ${#full_length} -gt 40 ]; then
echo "${full_length##*/}"
else
echo "$full_length"
fi
2021-06-12 18:27:40 +02:00
else
printf '\n'
2020-07-04 14:23:27 +02:00
fi