code: plan9front

Download patch

ref: cc7a274d01780313eb7fe952329fa4d4b10d2c05
parent: 970710ce92a363153637b0e176b66ac9cacfc929
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri May 12 12:42:40 EDT 2023

riow: add mod4+shift+q (delete current window)

--- a/sys/man/1/riow
+++ b/sys/man/1/riow
@@ -66,6 +66,9 @@
 Spawn a new
 .IR window (1).
 .TP
+.B Kmod4+shift+q
+Delete the current window.
+.TP
 .B Kmod4+h/j/k/l
 Focus left/down/up/right.
 .TP
--- a/sys/src/cmd/riow.c
+++ b/sys/src/cmd/riow.c
@@ -261,6 +261,18 @@
 	close(f);
 }
 
+static void
+delete(void)
+{
+	int f;
+
+	wsupdate();
+	if(wcur == nil || (f = wwctl(wcur->id, OWRITE)) < 0)
+		return;
+	fprint(f, "delete");
+	close(f);
+}
+
 static struct {
 	int x, y;
 }cyclectx;
@@ -354,6 +366,10 @@
 		}
 		if(r == 'k' && mod == Mmod4){
 			cycleaction(0, -1);
+			return 0;
+		}
+		if(r == 'Q' && mod == (Mmod4|Mshift)){
+			delete();
 			return 0;
 		}
 		if(r >= '0' && r <= '9' && (mod & Mctl) == 0){