shithub: rc

Download patch

ref: aa1d22a51cd316e4d8aa1565f44122d1fcc28525
parent: b9ed0fb64b408c3b6df521ecfb0474ff717cc2de
author: qwx <qwx@sciops.net>
date: Wed Jan 7 05:47:39 EST 2026

kx: add drawterm case, don't use smaller font on large screens

--- a/bin/kx
+++ b/bin/kx
@@ -1,6 +1,7 @@
 #!/bin/rc -b
 rfork ne
-wdir=/n/ssh/strpg
+pref=/n/ssh
+wdir=$pref/strpg
 usr=$user
 fn usage{
 	echo $0 >[1=2]
@@ -8,6 +9,10 @@
 }
 while(~ $1 -?){
 	switch($1){
+	case -d
+		pref=/mnt/term/home/$user
+		wdir=$pref/strpg
+		shift
 	case -r
 		wdir=/n/ssh/$2
 		shift
@@ -19,11 +24,13 @@
 	}
 	shift
 }
-if(! ~ $#* 1)
+if(~ $#* 1){
+	m=$1
+	if(! ~ $1 tcp!*)
+		m=tcp!$1!x
+}
+if not if(! ~ $pref /mnt/term/*)
 	usage
-m=$1
-if(! ~ $1 tcp!*)
-	m=tcp!$1!x
 . /tmp/sizes.$sysname
 
 f=()
@@ -35,18 +42,23 @@
 	eval 'f=('^$"f^')'
 }
 . /tmp/sizes.$sysname
-window -r $bsamrect 'echo 4 >/env/tabstop; echo -n /lib/font/bit/terminus/unicode.12m.font >/env/font; jam '^$"f
+
+if(test $screensize(1) -le 1920)
+	window -r $bsamrect 'echo -n /lib/font/bit/terminus/unicode.12m.font >/env/font; echo 4 >/env/tabstop; jam '^$"f
+if not
+	window -r $bsamrect 'echo 4 >/env/tabstop; jam '^$"f
 !
 
 cat <<! >/tmp/kx.$pid
 #!/bin/rc
-sshfs $usr@$m || exit
+if(~ $wdir /n/ssh/*)
+	sshfs $usr@$m || exit
 cd $wdir || {echo root directory $wdir does not exist >[1=2]; sleep 10; exit usage}
 unmount /mnt/plumb
 plumbsrv=()
 plumber -s plumb.$pid
 bof -i /tmp/work.$pid
-unmount /n/ssh
+unmount -q /n/ssh
 unmount /mnt/plumb
 rm -f /srv/plumb.$pid /tmp/kx.$pid /tmp/work.$pid
 !
--