Sway on Alpine (headless)
A machine running wayland in headless mode can be useful from time-to-time... for example browsing the internet from Oracle Cloud Infrastructure maybe.
Sway on Alpine VM
Sway on a full VM. Software to install (TODO: check this):
apk add sway swaybg foot mesa-dri-gallium wayvnc
Local bin
folder to house the custom start scripts for user
, this can be
added to .profile
:
export PATH=/home/${USER}/.local/bin:${PATH}
To get sway to start in headless mode there are several environment variables to set, putting these in startsway.sh would do the trick:
#!/bin/sh
export XDG_CURRENT_DESKTOP=sway
export XDG_RUNTIME_DIR=/dev/shm/${USER}/xdg
[ ! -d "${XDG_RUNTIME_DIR}" ] && mkdir -p "${XDG_RUNTIME_DIR}"
export WLR_NO_HARDWARE_CURSORS=1
export WLR_BACKENDS=headless
export WLR_RENDERER=pixman
export WLR_LIBINPUT_NO_DEVICES=1
sway
Sway will use /etc/sway/config
by default and a local file can be used to
override it:
mkdir -p .config/sway
cp /etc/sway/config .config/sway/config
At the bottom of the file, set the desktop size, start wayvnc
and a
terminal:
output "HEADLESS-1" resolution 1600x960
exec wayvnc --keyboard=gb-basic 0.0.0.0 5900 &
exec foot &
Logout and login again then running startsway.sh
should start a headless
sway that can be connected to via VNC:
vncviewer 192.168.80.25:0
Of course, using sway from a Windows computer is not so easy as the modifier key is the Windows key by default.
Sway on Alpine Container
TODO: Most of the stuff above will work in a container too...
Using Sway from Linux running Sway
This is the way the world was meant to work:
Using Sway from a Windows VNC Client
TODO: How to use sway from a Windows VNC client.