shithub: riow

Download patch

ref: 6547ade065de04a4361bb2ad859f9af7b944bfe9
parent: 8819833a6a6ab6a0a0148368dfd68a4534d47338
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Jan 27 04:21:49 EST 2021

window moving/resizing

--- a/README.md
+++ b/README.md
@@ -43,6 +43,15 @@
 Mod4-enter          start a new window
 Mod4-[0..9]         switch to a specific virtual desktop
 Mod4-shift-[0..9]   move the current window to a specific virtual desktop
+
+Mod4-[↑↓←→]         move the window (big steps)
+Mod4-shift-[↑↓←→]   move the window (small steps)
+
+Mod4-ctrl-[↑↓←→]        drag bottom-right of the window (big steps)
+Mod4-ctrl-shift-[↑↓←→]  drag bottom-right of the window (small steps)
+
+Mod4-alt-[↑↓←→]        drag top-left of the window (big steps)
+Mod4-alt-shift-[↑↓←→]  drag top-left of the window (small steps)
 ```
 
 ## Extras
--- a/riow
+++ b/riow
@@ -4,6 +4,10 @@
 # these are shown on every desktop
 sticky=(bar 'cat clock' clock desktop faces kbmap stats winwatch)
 
+# window move/resize step (in pixels)
+step=96
+stepsmall=8
+
 alt=0
 ctl=0
 shift=0
@@ -116,6 +120,33 @@
 	}
 }
 
+fn arrows {
+	winid=`{curwindow}
+	if(! ~ $#winid 0){
+		f=/dev/wsys/^$winid
+		x=+0
+		y=+0
+		if(~ $2 0)
+			s=$step
+		if not
+			s=$stepsmall
+		~ $1 up    && y=-$s
+		~ $1 right && x=+$s
+		~ $1 down  && y=+$s
+		~ $1 left  && x=-$s
+
+		if(~ $3 0 && ~ $4 0){
+			echo move -minx $x -miny $y >> $f/wctl
+		}
+		if not{
+			if(~ $4 0)
+				echo resize -maxx $x -maxy $y >> $f/wctl
+			if not
+				echo resize -minx $x -miny $y >> $f/wctl
+		}
+	}
+}
+
 fn handle {
 	# K is key down
 	# k is key up
@@ -151,6 +182,7 @@
 		if(~ $ukey [0-9] && ! ~ $ukey $curdesktop)
 			desktop $ukey
 	}
+	arrows $key $shift $ctl $alt
 }
 
 scrsize