From cec92894fcf3382a2d1dd8450c63767941fed404 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 22 Apr 2018 17:39:23 -0700 Subject: i3blocks scripts added --- .scripts/i3mpd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .scripts/i3mpd (limited to '.scripts/i3mpd') 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 -- cgit v1.3.1