aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm/mpc-status.sh
diff options
context:
space:
mode:
authorkatherine <shmibs@shmibbles.me>2016-01-22 05:22:00 -0700
committerkatherine <shmibs@shmibbles.me>2016-01-22 05:22:00 -0700
commit1fa62089b2c41f9c506c0bd14d2b8cdb10e95a76 (patch)
tree3d79eff6d8db462c9997af8e2920b27afd946194 /.config/herbstluftwm/mpc-status.sh
parent252c49b595fab379c600eb139d20b44731a76c98 (diff)
downloaddotfiles-1fa62089b2c41f9c506c0bd14d2b8cdb10e95a76.tar.gz
mpd status notification
Diffstat (limited to '.config/herbstluftwm/mpc-status.sh')
-rwxr-xr-x.config/herbstluftwm/mpc-status.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/.config/herbstluftwm/mpc-status.sh b/.config/herbstluftwm/mpc-status.sh
new file mode 100755
index 0000000..ef8bf11
--- /dev/null
+++ b/.config/herbstluftwm/mpc-status.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+case "$1" in
+ next)
+ mpc next
+ ;;
+ prev)
+ mpc prev
+ ;;
+ *)
+ ;;
+esac
+
+cd ~/music/
+dir=$(dirname "$(mpc current -f %file%)")
+# copying is necessary because notify-send can't into icon paths containing commas
+cp "$dir/cover-small.png" /tmp/mpd-icon.png
+
+message="$(mpc current -f '##%track% %title% (%date%)\n%artist% - %album%')
+
+$(mpc status | tail -n -2 | sed -re 's/volume.*repeat/\nrepeat/' -e 's/( ){3,4}/\n/g' -e '/volume: /d')"
+
+# i patched dunst to clear all on SIGUSR1
+killall -SIGUSR1 dunst
+
+notify-send --icon=/tmp/mpd-icon.png "$message"