aboutsummaryrefslogtreecommitdiff
path: root/bspwm/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'bspwm/scripts')
-rwxr-xr-xbspwm/scripts/bspwm/macropad.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/bspwm/scripts/bspwm/macropad.sh b/bspwm/scripts/bspwm/macropad.sh
new file mode 100755
index 0000000..0dcf843
--- /dev/null
+++ b/bspwm/scripts/bspwm/macropad.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# This script listen the events from BSPWM and report to the macropad the
+# layout to use.
+
+# The script only listen the events from switching one desktop to another one,
+# and do not report the events specific for a window.
+
+# Send to the macropad the appropriate layout depending of the desktop.
+send_layout() {
+ echo $1 | socat - TCP4:localhost:9999
+}
+
+bspc subscribe desktop | while read -r event monitor_id desktop_id name;
+do
+ case $event in
+ desktop_focus)
+ name=$(bspc query -D -d --names)
+ echo $name;
+ case $name in
+ Web)
+ send_layout "Firefox"
+ ;;
+ 6-girl)
+ send_layout "Num pad"
+ ;;
+ *)
+ #echo Num pad | socat - TCP4:localhost:9999;
+ ;;
+ esac;
+ esac;
+done