hlfw.ca

hwwm

Download patch

ref: c04889fa870ea80d733db3d2a943f633ba06d631
parent: 71c9879a92b81c397add1c9801c406cae75e7015
author: Halfwit <michaelmisch1985@gmail.com>
date: Fri Mar 17 13:05:57 PDT 2017

Bit hacked, but it works

--- a/wshuf
+++ b/wshuf
@@ -2,19 +2,14 @@
 # Requires https://github.com/wmutils
 
 # directory of files that correlate to window names
-WIN="$XDG_CONFIG_HOME"/x11/windows
+WIN="$XDG_CONFIG_HOME"/x11/window
 
-getname() {
-	cd $WIN
-	for i in *; do
-		watom "$1" WM_NAME | grep -io "$i" && break
-	done
-}
-
 winsize() {
 	while read -r id; do
-		name=`getname $id`
-		test -f $WIN/$name && . $WIN/$name || . $WIN/default
+		# Find our command to run in our file, else set it as default
+		cmd="`awk -v r="$(watom $id WM_NAME)" -v s="$(watom $id WM_CLASS)" '$0 ~ r || $0 ~ s {$1=""; print}' "$WIN"`"
+		test -z "$cmd" && cmd="`awk '/default/{$1=""; print}' "$WIN"`"
+		printf '%s %s\n' "`eval "$cmd"`" "$id"
 	done
 }