Running scrotwmos by hand
This guide is for a developer or user who runs the scrotwmos window
manager on an ordinary Linux box, outside the appliance. At the end you
have swm-x11, swm-wl, or swm-web running from your build. The
installed appliance needs none of this; see
installing.md.
The reference for each program is its man page: swm-x11(1), swm-wl(1), swm-web(1). The configuration, the sessions, and every key binding are in scrotwmos.conf(5).
Before you start
Build the tree:
make(building.md).Clear
LD_PRELOAD. A desktop that preloads a window manager hack library (spectrwm’s libswmhack does) breaks scrotwmos. The commands below carryLD_PRELOAD=for this reason.Write a configuration. scrotwmos reads
~/.scrotwmos.conf, or/etc/scrotwmos.confwhen there is no user file.swm-wlthen reads~/.scrotwmos-wayland.confon top.swm-x11 -c FILEandswm-wl -f FILEread one file instead.examples/swm-console.confis a good start.swm-wlrefuses a configuration with nosession_default. For plain host programs, add:session_default = host
Know the way out before you start:
| Key | Action |
|---|---|
MOD+Shift+Return |
open a terminal (program[term]) |
MOD+Shift+q |
quit |
MOD+q |
reload the config (swm-x11 restarts) |
MOD is Alt by default. modkey = Mod4 makes it Super.
swm-x11
Nested in a running X session, on a free display:
Xephyr :1 -screen 1280x800 &
LD_PRELOAD= DISPLAY=:1 ./build/bin/swm-x11/swm-x11
To make it your X session’s window manager, end ~/.xinitrc with the
binary and run startx:
exec /path/to/checkout/build/bin/swm-x11/swm-x11
swm-x11 is an ordinary X client: no seat, no root.
swm-wl nested
In a running Wayland or X11 session, wlroots picks the backend:
LD_PRELOAD= ./build/bin/swm-wl/swm-wl
swm-wl on the console
On the console, swm-wl needs a seat: something that hands it the
screen and the input devices. That is logind, or seatd, or the
swm-wl root monitor when you start it under sudo -E. Run it from a
virtual terminal. An ssh login has no seat.
Set up the machine once
On a machine with no logind (Void without elogind, for example):
Run seatd and join its group, then log out and back in. The group takes effect only at a new login:
sudo ln -sf /etc/sv/seatd /var/service/ sudo usermod -aG _seatd "$USER"Check that the font in
bar_fontexists:fc-list : family. For Terminus, a bitmap font, enable bitmap fonts first:sudo rm -f /etc/fonts/conf.d/70-no-bitmaps*.conf sudo ln -sf /usr/share/fontconfig/conf.avail/70-yes-bitmaps.conf \ /etc/fonts/conf.d/ fc-cache -fCheck that the terminal in
program[term]is installed.
Start it
cp examples/swm-console.conf ~/swm-console.conf
./scripts/start-swm.sh
start-swm.sh makes XDG_RUNTIME_DIR (/tmp/swm-<uid>) when there
is none, sets SWM_VT to the current console, clears LD_PRELOAD, and
starts swm-wl on the config. The config is SWM_CONF, else its
argument, else ~/swm-console.conf. SWM_BIN names the binary;
the default is ~/scrotwmos/build/bin/swm-wl/swm-wl.
The log is ~/swm-console.log (SWM_LOG). A VM’s serial console is
~/swm-serial.log (SWM_SERIAL). If the screen stays black, switch
back with Ctrl-Alt-F1 and read the log. If swm-wl crashes, the VT
can stay in graphics mode. Run chvt <n> from another VT or over ssh.
Without the script, make a short XDG_RUNTIME_DIR yourself (a socket
path holds 108 bytes at most):
export XDG_RUNTIME_DIR=/tmp/swm-$(id -u)
install -d -m 0700 "$XDG_RUNTIME_DIR"
LD_PRELOAD= ./build/bin/swm-wl/swm-wl 2> /tmp/swm.log
Sessions on the console
examples/swm-console.conf runs every program on the host, as you:
it isolates nothing. examples/swm-session.conf adds a container on
workspace 2 and a VM on workspace 3. A program starts in the session
of the focused workspace.
Sessions need the root monitor, which needs Linux 6.16 or newer.
start-swm.sh starts again under sudo when the config has a session.
On an older kernel, swm-wl exits with privsep: no sync channel.
Before the first run:
Build a Void root for the container with
make rootfs ROOTFS=/srv/<label>. Installscrotwmdin it. Installswm-vmmin/usr/local/bin(make vmm). Each session runs as its own uid, which cannot read your home. The comments inexamples/swm-session.confgive the paths.Build the VM kernel:
make kernel.Make the VM’s volume from a root, and give it to the session’s uid:
sudo make -f mk/volume.mk ROOTFS=<rootfs> VOLUME=/srv/vm.img \ VOLUME_SIZE=4G VOLUME_SUDO= sudo chown 500002:500002 /srv/vm.imgA volume that exists is left alone. To make it again, remove it first.
For a shared directory, follow the
share_dircomments in the example: root owns it, its group isshare_gid, mode 2775.
scrotwmos.conf(5), SESSIONS, has every session_* key.
swm-web
swm-web serves the window manager to a web browser. Each window is a
terminal.
./build/bin/swm-web/swm-web -p 8081 -w 1280 -h 800
Then open http://localhost:8081/. It listens on loopback alone and
opens a WebSocket only for its own page. It asks for no password: any
local user who reaches the port gets a shell as you. Run it only on a
machine whose users you trust. swm-web(1) has its options and its keys, which differ from the
others.