hlfw.ca

hwwm

Download patch

ref: d79212c77eaee3aff30b6feb491b104e5cae1297
parent: 0cdbc1d45b705ced8666b8eef781de176cf8d9ec
author: Halfwit <michaelmisch1985@gmail.com>
date: Fri Jul 13 17:27:02 PDT 2018

Change to using variables here

Signed-off-by: Halfwit <michaelmisch1985@gmail.com>

--- a/hwwm
+++ b/hwwm
@@ -1,7 +1,8 @@
 #!/bin/sh
 DIR=/usr/local/share/hwwm
 # Colors
-barcolor="$(awk -f "$XDG_CONFIG_HOME/x11/Xresources" '/color4/{print $NF}')"
+highlight="$(xrdb -query | awk '/desktop/{print $NF}' | sed 's/#//')"
+normal="$(xrdb -query | awk '/background/{print $NF}' | sed 's/#//')"
 
 FOCUS_MASK=2097152
 wew -m $FOCUS_MASK | while read -r ev; do
@@ -11,9 +12,9 @@
 	fullscreen="$(watom `lsw -r` FS 2>/dev/null)"
 	case "$ev" in
 		# Focus in
-		9*)	chwb -s 2 -c 458588 "$wid" ;;
+		9*)	chwb -s 2 -c "$highlight" "$wid" ;;
 		# Focus out
-		10*) chwb -s 2 -c 3c3836 "$wid" ;;
+		10*) chwb -s 2 -c "$normal" "$wid" ;;
 		# Unmap
 		18*)	if test -z $fullscreen; then 
 				$DIR/wshuf | xargs -n 5 wtp
--- a/inotifybar
+++ b/inotifybar
@@ -31,6 +31,10 @@
 test -f "$statusdir/git" && read -r git < "$statusdir/git"
 test -f "$statusdir/media" && read -r media < "$statusdir/media"
 
+# This will fail unless you have something set for *desktop in your Xresources!
+background="$(xrdb -query | awk '/background/{print $NF}')"
+foreground="$(xrdb -query | awk '/desktop/{print $NF}')"
+
 barrun() {
 inotifywait -qme close_write --format %f "$statusdir" | while read -r file; do
 	if read -r -- "$file" < "$statusdir/$file"; then
@@ -38,7 +42,7 @@
 		# We inexplicably need to force a redraw here
 		/usr/local/share/hwwm/wshuf | xargs -n 5 wtp
 	fi
-done | lemonbar -F '#000000' -B '#FFFFFF' -d -b -f "DejaVu Book:size=9.5" -f "Symbola:size=9.5" -f "FreeSans:size=9.5"
+done | lemonbar -F "$foreground" -B "$background" -d -b -f "DejaVu Book:size=9.5" -f "Symbola:size=9.5" -f "FreeSans:size=9.5"
 }
 
 barrun