1
0

2025-04-18

This commit is contained in:
dtb 2025-04-18 09:53:43 -06:00
parent 12bd97447b
commit f14330ee0f
2 changed files with 86 additions and 0 deletions

View File

@ -1050,6 +1050,92 @@ pre { /* DRY who? */
}
/blah/2025-04-18.html
: X without the WM
I use a netbook for /only/ SShing into this CM4 uConsole. The netbook runs
NetBSD/i386 and my usual behavior is something like
sanichi$ ssh laika.lan
laika$ tmux
which works well for me, except for fancy UTF-8 TUI programs, which look ugly,
because the NetBSD tty(4) supports ASCII only (as far as I know, though I did
check the manual).
I don't want windows or decorations, I don't want clocks or status bars, I just
want tmux in a terminal window. I'm going to achieve this using xinit(1) (which
comes with the full NetBSD system) and xdotool(1).
# pkgin install xdotool
This command assumes the use of pkgsrc; adapt it to other package managers if
need be. I don't know much about modular-xorg so you may need to futz a bit to
find xinit(1).
$ cd; vi .xinitrc
And here's the entire .xinitrc:
xdotool search --sync --class xterm windowsize 100% 100% & exec xterm
Not bad for 80B, eh? Let's chart it out:
xdotool ; xdotool(1) - command-line X11 automation tool
search ; Find a certain window.
--sync ; Wait until it's found.
--class xterm ; It calls itself "xterm". When you find it,
windowsize ; resize it.
100% ; Make it fill the view horizontally.
100% ; Make it fill the view vertically.
& ; Don't wait for this command to finish before
; starting the next one.
exec ; Start this next program in the X server, and
; when it finishes, close the X server.
xterm ; xterm(1) - terminal emulator for X
I can exit X by either sending an EOF (that's ^D) from xterm(1) or, if it
freezes, switching to ttyE0 and sending a ^C to the running X server.
I initially passed xterm(1) `-e tmux` to start tmux, but I've found I still
prefer to SSh into laika before starting tmux, so all my terminals are remote
(one for mail, one for writing, one for debugging, one for man pages).
I did add `xrdb -load ~/.Xresources` before the xdotool(1)/xterm(1) line, so
xterm(1) would load with my preferred color scheme which I've already
configured (also see X(7)). I thought this might be automatic, but on here it's
not.
I'm finishing this blah post on my netbook running NetBSD/i386 and an X11
server, in which xterm(1) is running, in which ssh(1) is running, connected to
my uConsole across the room, on which tmux(1) is running, in which nvim(1) is
running. The UTF-8 is beautiful and bat(1) (a guilty pleasure of mine) looks
good.
If I was going to use this computer for anything more than terminals, I'd just
use a window manager. I thought about using sxhkd(1) for this task but it
ultimately proved to be unnecessary.
I added the following to my $ENV (see sh(1)):
# Don't start X if I'm on a framebuffer kick or am in tmux(1) (or screen(1)).
if test -z "$NO_WM" && ! test "$TERM" = screen
then case "$0" in
-*) startx ;; # Do start X if I'm in a login shell
# (see bash(1)).
esac
fi
Which seems to work well. If it failed dreadfully I could reboot and login as
root.
I don't have much more to say. Don't be scared of X - in conjunction with
xinit(1) and startx(1) it's quite easy to use. Don't be scared of Wayland
either - it may not yet run well on NetBSD, but if you get a chance to try it,
you might really like it.
/blah/2025-04-05.html
My habitual "the story so far" was long delayed because I didn't remember what