From 8ec3a1d67c3fb8b35a3ad920e7208616d6a1f0a1 Mon Sep 17 00:00:00 2001 From: katherine Date: Mon, 1 Feb 2016 19:18:18 -0700 Subject: handle stopped / disconnected --- .config/herbstluftwm/mpc-status.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to '.config/herbstluftwm') 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 -- cgit v1.2.3