shithub: riow

Download patch

ref: cb62c1f6952b66a4afc124ce39305ac5535718f5
parent: 1b76299cd07cc240cc29f74b2b8a25e80d47e3ee
author: Sigrid Haflínudóttir <[email protected]>
date: Sun Mar 29 12:31:12 EDT 2020

add a script that parses gkbd's output

--- /dev/null
+++ b/riow
@@ -1,0 +1,29 @@
+#!/bin/rc
+rfork ne
+
+oldgdown=0
+
+fn gdown {
+	if(! ~ $oldgdown $1){
+		if(~ $1 0)
+			echo down $oldgdown → $1
+		if not
+			echo up $oldgdown → $1
+		oldgdown=$1
+	}
+}
+
+fn handlekey {
+	echo keydown $*($#*)
+}
+
+while(s=`{read}){
+	# glenda key alone
+	if(~ $s(1) K && ~ $#s 1)
+		gdown 0
+	if(~ $s(1) k && ~ $s(2) glenda)
+		gdown 1
+	if(~ $s(1) c){
+		handlekey $s
+	}
+}