summaryrefslogtreecommitdiffstats
path: root/.scripts/i3mpd
diff options
context:
space:
mode:
Diffstat (limited to '.scripts/i3mpd')
-rwxr-xr-x.scripts/i3mpd18
1 files changed, 18 insertions, 0 deletions
diff --git a/.scripts/i3mpd b/.scripts/i3mpd
new file mode 100755
index 0000000..b2a34bb
--- /dev/null
+++ b/.scripts/i3mpd
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Pass the password in the block instance
+if [[ -n $BLOCK_INSTANCE ]]; then
+ password=("-h" "$BLOCK_INSTANCE@localhost")
+fi
+
+filter() {
+ tr '\n' ' ' | grep -Po '.*(?= \[playing\])|paused' | tr -d '\n'
+}
+
+case $BLOCK_BUTTON in
+ 1) mpc $password status | filter && $TERMINAL -e ncmpcpp & disown ;; # right click, pause/unpause
+ 3) mpc $password toggle | filter ;; # right click, pause/unpause
+ 4) mpc $password prev | filter ;; # scroll up, previous
+ 5) mpc $password next | filter ;; # scroll down, next
+ *) mpc $password status | filter ;;
+esac