shithub: rc

Download patch

ref: a3b65bdc62dab210dab60c6a3fcc5ce31606d987
parent: 98421abf7681f7ae8d49c4e4e82ffbdc6b215ef6
author: qwx <qwx@sciops.net>
date: Mon May 29 04:49:02 EDT 2023

add 𝕊: general purpose shortcuts(1) in awk

--- /dev/null
+++ b/bin/𝕊
@@ -1,0 +1,44 @@
+#!/bin/rc -b
+rfork ne
+bind '#|' /n/ass
+
+</n/ass/data1 {
+	tr \x0 \xa |\
+	awk \
+'
+function io(c, f){
+	print c >f
+	close(f)
+}
+/^k/{
+	split($0, s, "")
+	for(i=2; i<=length(s); i++){
+		k = s[i]
+		if(!(k in h)){
+			if(k == "")
+				system("plumb -d audio ''key <''")
+			else if(k == ""){
+				system("plumb -d audio ''key p''")
+				system("Sta")
+			}else if(k == ""){
+				system("plumb -d audio ''key >''")
+				system("Fw")
+			}else if(k == "")
+				io("master toggle", "/dev/volume")
+			else if(k == "")
+				system("v-")
+			else if(k == "")
+				system("v+")
+		}
+	}
+}                                                                                         
+/^K/{
+	delete h
+	split($0, s, "")
+	for(i=2; i<=length(s); i++)
+		h[s[i]] = 1
+}
+'
+} &
+
+tee /n/ass/data