aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.config/herbstluftwm/mpc-status.sh13
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