shithub: riow

Download patch

ref: 92b2606926a90158e8c9c6ecb0c73c93e5ac424b
parent: 7e6be8df4f6faa0f2d2748aa079d02513153d01b
author: Sigrid Haflínudóttir <[email protected]>
date: Sun Mar 29 13:45:13 EDT 2020

G+enter=window, G+f=toggle_fullscreen

--- a/riow
+++ b/riow
@@ -6,6 +6,28 @@
 glenda=0
 shift=0
 
+fn scrsize {
+	s=`{syscall -o read 0 buf 60 </dev/screen >[2]/dev/null}
+	screenw=$s(4)
+	screenh=$s(5)
+}
+
+fn fullscreen {
+	scrsize
+	for(f in /dev/wsys/*){
+		a=`{syscall -o read 0 buf 64 <$f/wctl >[2]/dev/null}
+		if(~ $a(5) current){
+			winid=`{basename $f}
+			if(~ $a(1) 0 && ~ $a(2) 0 && ~ $a(3) $screenw && ~ $a(4) $screenh)
+				echo resize -r `{eval echo '$winsize_'^$winid} >$f/wctl
+			if not {
+				eval 'winsize_'^$winid'=$a(1 2 3 4)'
+				echo resize -r 0 0 9999 9999 >$f/wctl
+			}
+		}
+	}
+}
+
 fn handle {
 	# remember old states
 	oalt=$alt
@@ -39,8 +61,10 @@
 			shift
 		}
 	}
-	if(! ~ $key '')
-		echo 'shift='^$shift 'alt='^$alt 'ctl='^$ctl 'glenda='^$glenda 'key='^$key
+	if(~ $key enter)
+		window
+	if(~ $key f)
+		fullscreen
 }
 
 while(s=`{read}){