dwmbar/modules/mpd

26 lines
449 B
Text
Raw Permalink Normal View History

2019-10-21 22:51:27 +00:00
#!/bin/bash
PREFIX_PLAY=' '
PREFIX_PAUSE=' '
2019-10-21 22:51:27 +00:00
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
echo " "
2019-10-21 22:51:27 +00:00
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