commit b5d80f8

hovercats  ·  2024-09-08 04:03:48 +0000 UTC
parent 023129e
watcher: rewrite in rc
2 files changed,  +16, -13
+16, -0
 1@@ -0,0 +1,16 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+while(ev=`{read -n 1}) {
 7+	switch($ev(1)) {
 8+		case MAP
 9+			wattr o $ev(2) || focus $ev(2)
10+		case CREATE
11+			wattr o $ev(2) || focus $ev(2)
12+		case UNMAP
13+			test ! `{pfw} && focus top
14+		case DESTROY
15+			test ! `{pfw} && focus top
16+	}
17+}
+0, -13
 1@@ -1,13 +0,0 @@
 2-#!/bin/sh
 3-
 4-set -e
 5-
 6-# Based on https://github.com/wmutils/contrib/blob/master/focus_watcher.sh
 7-# and https://git.disroot.org/root_informatica/wms/src/branch/main/wms_voyeur.sh
 8-
 9-while read -r ev wid; do
10-	case $ev in
11-		MAP) wattr o "$wid" || focus "$wid" ;;
12-		UNMAP) [ ! "$(pfw)" ] && focus top ;;
13-	esac
14-done