diff options
author | katherine <shmibs@shmibbles.me> | 2016-02-01 19:18:18 -0700 |
---|---|---|
committer | katherine <shmibs@shmibbles.me> | 2016-02-01 19:18:18 -0700 |
commit | 8ec3a1d67c3fb8b35a3ad920e7208616d6a1f0a1 (patch) | |
tree | 5848452adbe4274fd2e31d4a82e7c82bdc319fb3 | |
parent | 0718bee356f08e9f97c311411e1c2c560e5a7758 (diff) | |
download | dotfiles-8ec3a1d67c3fb8b35a3ad920e7208616d6a1f0a1.tar.gz |
handle stopped / disconnected
-rwxr-xr-x | .config/herbstluftwm/mpc-status.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.config/herbstluftwm/mpc-status.sh b/.config/herbstluftwm/mpc-status.sh index ef8bf11..26e249c 100755 --- a/.config/herbstluftwm/mpc-status.sh +++ b/.config/herbstluftwm/mpc-status.sh @@ -11,6 +11,19 @@ case "$1" in ;; esac +mpc status >/dev/null 2>&1 +if [[ $? -ne 0 ]]; then + killall -SIGUSR1 dunst + notify-send "mpd disconnected" + exit +fi + +if [[ -z "$(mpc status | grep -E '\[(playing|paused)\]')" ]]; then + killall -SIGUSR1 dunst + notify-send "mpd stopped" + exit +fi + cd ~/music/ dir=$(dirname "$(mpc current -f %file%)") # copying is necessary because notify-send can't into icon paths containing commas |