Synopsis #
Install Sway and start a tiling Wayland session using the OpenBSD package launcher. For the display system, requirements, and other compositors, see The Wayland Display System .
This guide follows the OpenBSD 8.0 amd64 Sway package.
It requires a local text console, supported graphics hardware, and administrative access
for package installation and stopping xenodm.
Keep a working X11 session
available while setting up Sway.
Install and Configure Sway #
Install the compositor and Xwayland for X11 applications:
doas pkg_add sway xwayland
less /usr/local/share/doc/pkg-readmes/sway
Read the installed README before changing session startup.
The package supplies /etc/sway/config and a sample under /usr/local/share/examples/sway/.
For an account without an existing Sway configuration, copy the sample.
Do not overwrite an existing configuration:
mkdir -p ~/.config/sway
cp /usr/local/share/examples/sway/config ~/.config/sway/config
If XDG_CONFIG_HOME is set, use its sway/config path instead.
The configuration defines the modifier key, terminal, application launcher, and exit binding.
Read man 5 sway and check those bindings before leaving the current desktop.
The OpenBSD sample selects xterm, which needs Xwayland.
Start from a Text Console #
Save work and log out of the graphical session first.
Stopping xenodm terminates any remaining sessions it manages.
From a local text console, stop it for this test without disabling startup at boot:
doas rcctl stop xenodm
Log in as the ordinary desktop account and run the package launcher:
/usr/local/bin/startsway.sh
The launcher sets OpenBSD-specific defaults, including the runtime directory and display device. Use it rather than copying Linux service or seat-management instructions. Do not run the desktop as root or make device nodes writable by everyone to bypass a startup error.
Check the Session #
From a terminal inside Sway, inspect the active displays:
swaymsg -t get_outputs
Confirm that the expected monitor appears, keyboard and pointer input work, and a terminal opens using the configured binding. Test required applications individually; a working compositor does not establish that every application uses Wayland natively.
If startup fails, run the launcher with debug output from the text console:
/usr/local/bin/startsway.sh -d > ~/sway.log 2>&1
Check the log for the failing graphics device or input backend and compare it with the installed package README and dmesg.
The supplied launcher defaults to /dev/dri/card0; a machine with multiple graphics devices can require a different selection.
Inspect startsway.sh before customizing its environment.
Return to X11 #
Exit Sway using the binding in the configuration, then restart the display manager from the text console:
doas rcctl start xenodm
Keep the X11 configuration separate from ~/.config/sway/config.
For other desktops and window managers, see OpenBSD Desktop Environments
.