summaryrefslogtreecommitdiff
path: root/music
diff options
context:
space:
mode:
Diffstat (limited to 'music')
-rwxr-xr-xmusic24
1 files changed, 24 insertions, 0 deletions
diff --git a/music b/music
new file mode 100755
index 0000000..2ec8aec
--- /dev/null
+++ b/music
@@ -0,0 +1,24 @@
+#!/sbin/sh
+
+filter() {
+ if [ `pgrep -x mpd` ]; then
+ MPCSTAT="$(mpc status)" ;
+ printf "%s%s%s" "$(echo $MPCSTAT | head -1 | grep -v '^volume' | cut -d'-' -f1 | sed 's/ $//' | cut -c-10)" "$(echo $MPCSTAT | grep -vq '^volume' && echo ' - ')" "$(echo $MPCSTAT | head -1 | grep -v '^volume' | cut -d'-' -f2 | sed 's/^ //' | cut -c-10)"
+ fi
+}
+
+pidof -x mpdup >/dev/null 2>&1 || mpdup >/dev/null 2>&1 &
+
+case $BLOCK_BUTTON in
+ 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # left click, open music player
+ 3) mpc toggle | filter ;; # right click, pause/unpause
+ 2) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
+- Italic when paused.
+- Left click opens ncmpcpp.
+- Middle click pauses.
+- Scroll changes track.";; # right click, pause/unpause
+ 4) mpc prev | filter ;; # scroll up, previous
+ 5) mpc next | filter ;; # scroll down, next
+ 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
+ *) filter ;;
+esac