Dotfiles-dwm/dwmbar/modules/mpd

26 lines
449 B
Plaintext
Raw Normal View History

2024-06-02 11:02:06 +00:00
#!/bin/bash
PREFIX_PLAY=' '
PREFIX_PAUSE=' '
get_mpd()
{
current_song="$(mpc current)"
if [[ "$current_song" = "" ]]; then
echo " "
exit 0
else
playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}')
if [[ "$playpause" = "[playing]" ]]; then
current_song="$PREFIX_PLAY $current_song"
elif [[ "$playpause" = "[paused]" ]]; then
current_song="$PREFIX_PAUSE $current_song"
fi
fi
echo "$current_song"
}
get_mpd