commit 6ab38e7

hovercats  ·  2024-06-07 17:33:22 +0000 UTC
parent 7cc2676
watcher: add. add top case on focus to use with watcher to regain focus when windows are created/killed
2 files changed,  +12, -0
+1, -0
1@@ -33,6 +33,7 @@ setborder() {
2 case $1 in
3     next) wid="$(lsw | grep -v "$CUR" | sed '1 p;d')" ;;
4     prev) wid="$(lsw | grep -v "$CUR" | sed '$ p;d')" ;;
5+    top) wid="$(lsw | sed '$ p;d')" ;;
6     0x*) wattr "$1" && wid="$1" ;;
7     *) usage ;;
8 esac
+11, -0
 1@@ -0,0 +1,11 @@
 2+#!/bin/sh
 3+
 4+# Based on https://github.com/wmutils/contrib/blob/master/focus_watcher.sh
 5+# and https://git.disroot.org/root_informatica/wms/src/branch/main/wms_voyeur.sh
 6+
 7+while read ev wid args; do
 8+	case $ev in
 9+		MAP) wattr o $wid || focus top ;;
10+		UNMAP) [ ! "$(pfw)" ] && focus top ;;
11+	esac
12+done