These are my notes from experimenting with building Wayland bits on OpenBSD during g2k23 in Tallinn… Thanks to the OpenBSD foundation for organizing this event.
This is still far from a complete running system as there are many issues on the road, but it’s a good start and it shows that it’s definatly not impossible to get Wayland running on OpenBSD.
Updated to reflect that all of this in now a work in progress set of ports
I don’t know much about Wayland internals, I’m discovering that on the way, so some stuff here may look naive or totally wrong to experimented Wayland developers…
I’m not discussing here on why Wayland ? You may find some answers in this paper I wrote in 2017 (in french).
The build instructions below will probably break your system. Use a separate machine for this
libudev-openbsd
port already that can be used.All this works on top of existing Xenocara and ports.
All needed ports are available on this repository.
This can be cloned into mystuff
to build and install the packages over and existing ports tree.
cd /usr/ports
git clone https://gitlab.tetaneutral.net/mherrb/wl-ports.git mystuff
cd mystuff/wayland/sway
make install
The original project in on Source Hut
The OpenBSD port is very minimal but enough for now. TODO: make it more complete WRT VT switching, using fbtab and some sort of session management.
This is the version from mpi@, patched@ by radowski, plus extra udev code from me.
I’ve now added proper events translation (for mouse buttons and keyboard) so that the input works in a usable way in Wayland.
This is a stripped-down version of libevdev, providing just the few functions to handle name to symbol conversions that are used by most Wayland applications.
Those two small helper libraries build of of the box on OpenBSD. I’ve made ports for them in my xenoports tree, or they can be built from gitlab:
It’s a straightforward port of the upstream release.
A version of wlroots that has been patched for OpenBSD. The wscons backend code can dropped for now. I’m not sure if it will ever be possible to have Wayland applications running without libinput (but that’s the goal of this backend).
Havoc is the simplest terminal emulator application for Wayland that I could find and that builds on OpenBSD with minimal changes.
Sway is a tiled Wayland compositor, compatible with i3, ported to OpenBSD
TODO : port
An image viewer for Wayland that builds on OpenBSD without patches \o/
git clone https://github.com/artemsen/swayimg.git
cd swayimg
meson setup build
ninja -C build
doas -C build ninja install
Wayland doesn’t provide cursors by itself. So one needs to install the gnome-icon-theme
package or any other package providing a default theme.
Because of the cursor path mentionned above, link /usr/local/share/icons to ~/.icons
for now to get cursors.
Note: swaybar used to segfault if it’s missing a cursor, it should be fixed in the current port
Wayland is using fontconfig
. So it can use any fonts installed via pkg_add
swaybar expects the terminus font to be available.
One needs to set a number of environment variables. The following script (runwl
) helps:
#! /bin/ksh
export XDG_RUNTIME_DIR=/tmp
export WAYLAND_DISPLAY=wayland-0
exec $*
Start seatd
This gives the /var/run/seatd.sock to my user, so that the applications will be run as my uid, not root.
doas seatd -u $(whoami) -l debug
Start sway:
export XDG_RUNTIME_DIR=/tmp
export WLR_DRM_DEVICES=/dev/dri/card0
sway
start an application (here havoc)
runwl havoc
Sway starts Xwayland automatically if an application needs X
It can also be started manually, but not in rootless mode (this is a Wayland security feature). X applications work in the Xwaylan in windowed mode, but OpenGL X applications crash (probably because of mismatched Mesa versions in my builds FIXME
Simple patches allows to build gtk+3 and gtk+4 with wayland support enabled. gtk3-demo works, built against the patched version.
Note that both emacs and mozilla-firefox work, but still use Xwayland. The ports need some plist and lib-depends patches once wayland support is enabled in gtk+3/4.
So far gtk4-demos fails to start, it still tries to connect to an X serer and segfault. FIXME
Qt 5 and 6 are normally built with Wayland support. I tried keepassxc(1) (Qt5) which could’nt connect to the compositor. qt6/qtbase doesn’t build on my system from some reason. FIXME
A number of Wayland applications use UTF-32 internally and require support for the above that it not (yet) available on OpenBSD. TODO: one implementation exists in DragonFlyBSD.
Thay would probably unlock foot and others.
To get a screen locker, swaylock needs to be tought about BSD auth to replace PAM.
None of the above currenty implement pledge() or unveil() support, nor any other from of sandboxing afaict. This could be looked at at some point.
Last modified: 2023-07-16T19:21:00