dwmbar/modules/mpd

25 lines
438 B
Text
Raw Normal View History

2019-10-21 22:51:27 +00:00
#!/bin/bash
PREFIX_PLAY=' '
PREFIX_PAUSE=' '
get_mpd()
{
2019-10-25 12:11:58 +00:00
current_song="$(mpc current)"
2019-10-21 22:51:27 +00:00
if [[ "$current_song" = "" ]]; then
exit 0
else
playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}')
if [[ "$playpause" = "[playing]" ]]; then
2019-10-25 12:11:58 +00:00
current_song="$PREFIX_PLAY $current_song"
2019-10-21 22:51:27 +00:00
elif [[ "$playpause" = "[paused]" ]]; then
2019-10-25 12:11:58 +00:00
current_song="$PREFIX_PAUSE $current_song"
2019-10-21 22:51:27 +00:00
fi
fi
2019-10-25 12:11:58 +00:00
echo "$current_song"
2019-10-21 22:51:27 +00:00
}
get_mpd