summaryrefslogtreecommitdiffstats
path: root/.scripts/i3mpd
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-04-22 17:39:23 -0700
committerLuke Smith <luke@lukesmith.xyz>2018-04-22 17:39:23 -0700
commitcec92894fcf3382a2d1dd8450c63767941fed404 (patch)
tree18250c00e6be565f8e16ae0bc45a9c7774f1034e /.scripts/i3mpd
parent84557167e6a3c678202d4edb6dc06d1c8dfde51f (diff)
downloadeibhear-cec92894fcf3382a2d1dd8450c63767941fed404.tar.gz
eibhear-cec92894fcf3382a2d1dd8450c63767941fed404.tar.zst
eibhear-cec92894fcf3382a2d1dd8450c63767941fed404.zip
i3blocks scripts added
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