WaylandWayland is a modern display server protocol designed to replace the X Window System (Xorg). Rather than routing all display communication through a central X server, Wayland compositors act as both the display server and the window manager, communicating directly with client applications and the kernel's Direct Rendering Manager (DRM). This architecture reduces latency, improves security by isolating application windows from each other, and eliminates many of the legacy layers in the X11 stack.
Wayland support on MidnightBSD is functional but still maturing. Users comfortable with configuring BSD systems manually will find it workable. Those who prefer a more polished out-of-the-box experience may wish to continue using Xorg until support matures further. Some hardware and some applications may still require Xorg or XWayland compatibility.
Before setting up Wayland, ensure the following is in place:
dbus message bus, which is required by most Wayland compositors
and desktop components.video group to access
DRM devices.Add your user to the video group as root:
pw groupmod video -m username
Enable dbus in /etc/rc.conf and start it:
sysrc dbus_enable="YES"
service dbus start
Wayland requires kernel-level GPU support through DRM and KMS. The drm-kmod
package provides the necessary kernel modules for Intel and AMD GPUs.
Install drm-kmod from mports:
mport install drm-kmod
Enable the appropriate module for your GPU in /etc/rc.conf.
For Intel integrated graphics (Haswell and newer):
sysrc kld_list="i915kms"
For AMD GPUs (Southern Islands and newer):
sysrc kld_list="amdgpu"
For older AMD GPUs (pre-Southern Islands):
sysrc kld_list="radeonkms"
Load the module immediately without rebooting:
kldload i915kms
After loading, verify the DRM device nodes are present:
ls /dev/dri/
You should see entries such as card0 and renderD128. If
/dev/dri/ is empty or missing, the GPU module did not load correctly.
Check dmesg for errors.
NVIDIA GPUs are not currently supported through the open DRM path. NVIDIA users should use Xorg with the proprietary nvidia driver from mports.
Wayland compositors need permission to open DRM and input devices without running as root.
On MidnightBSD, this is handled by seatd, a lightweight seat management
daemon. It grants compositors privileged device access on behalf of logged-in users.
Install seatd from mports:
mport install seatd
Enable and start seatd:
sysrc seatd_enable="YES"
service seatd start
Add your user to the _seatd group so the compositor can communicate with
the daemon:
pw groupmod _seatd -m username
You must log out and log back in for group membership changes to take effect.
Set the LIBSEAT_BACKEND environment variable so compositors use seatd:
export LIBSEAT_BACKEND=seatd
Add this to your shell startup file (~/.profile, ~/.bashrc,
or ~/.zshrc) so it is set automatically at login.
A Wayland compositor combines the roles of display server and window manager. Several compositors are available in mports. The right choice depends on whether you prefer a tiling or stacking (floating) window layout.
Sway is a tiling Wayland compositor that is a drop-in replacement for the i3 window manager. It is the most widely used and tested Wayland compositor on BSD systems. Sway arranges windows automatically in a non-overlapping tiled layout and is configured through a plain text file.
Install sway and its status bar:
mport install sway swaybar
Copy the default configuration as a starting point:
mkdir -p ~/.config/sway
cp /usr/local/etc/sway/config ~/.config/sway/config
Start sway from the console:
sway
The default configuration sets the Super (Windows) key as the modifier. Key bindings of note from the default config:
Super+Return — open a terminal (foot or xterm)Super+d — open the application launcher (dmenu or wofi)Super+Shift+q — close the focused windowSuper+Shift+e — exit swaySuper+Arrow — move focus between windowsSuper+Shift+Arrow — move windows within the layoutSuper+number — switch to workspaceThe sway configuration file at ~/.config/sway/config uses the same
syntax as i3. Refer to man 5 sway for all available options.
Wayfire is a stacking (floating) compositor with a plugin-based architecture and visual effects. It is suitable for users who prefer a more traditional desktop layout where windows can overlap freely.
Install Wayfire from mports:
mport install wayfire
Copy the example configuration:
mkdir -p ~/.config
cp /usr/local/share/doc/wayfire/wayfire.ini ~/.config/wayfire.ini
Start Wayfire from the console:
wayfire
Wayfire is configured through ~/.config/wayfire.ini. Plugins for
window decorations, a panel, a background, and other features are enabled and
configured in this file. Refer to man wayfire and the project
documentation for the full list of available plugins.
labwc is a lightweight stacking compositor modeled after Openbox. It uses XML configuration files in the same format as Openbox and is well suited for users migrating from an Openbox-based setup or who want a minimal, traditional floating window manager under Wayland.
Install labwc from mports:
mport install labwc
Create the configuration directory and copy the default files:
mkdir -p ~/.config/labwc
cp /usr/local/etc/xdg/labwc/rc.xml ~/.config/labwc/rc.xml
cp /usr/local/etc/xdg/labwc/menu.xml ~/.config/labwc/menu.xml
Start labwc from the console:
labwc
Weston is the reference Wayland compositor maintained by the Wayland project. It is primarily intended as a demonstration and testing environment rather than a daily-use desktop, but it is stable and useful for verifying that your Wayland setup is working correctly before configuring a more full-featured compositor.
Install Weston from mports:
mport install weston
Start Weston from the console:
weston
Weston can also be started with a specific backend if needed, for example to run inside an existing X session for testing:
weston --backend=x11
XWayland is an X server that runs as a Wayland client, providing backward compatibility for applications that have not yet been ported to Wayland. It allows X11 applications to run inside a Wayland compositor session without a separate Xorg server. Most compositors start XWayland automatically when an X11 application requests it.
Install XWayland from mports:
mport install xwayland
In sway, XWayland can be disabled if you do not need X11 application support, which
reduces the attack surface. Add to ~/.config/sway/config:
xwayland disable
To force a specific application to use XWayland even within a Wayland session, set
GDK_BACKEND=x11 for GTK applications or QT_QPA_PLATFORM=xcb
for Qt applications before launching them.
Several environment variables must be set for a Wayland session to work correctly.
Add these to your shell startup file (~/.profile for login shells) so
they are available in all applications launched from the compositor.
XDG_RUNTIME_DIR points to a per-user directory for runtime files such
as the Wayland socket. It must be set before starting a compositor:
export XDG_RUNTIME_DIR=/var/run/user/$(id -u)
Create the directory if it does not exist and set the correct permissions:
mkdir -p /var/run/user/$(id -u)
chmod 700 /var/run/user/$(id -u)
The Wayland compositor sets WAYLAND_DISPLAY automatically. It is
typically wayland-0 and points to the compositor's socket inside
XDG_RUNTIME_DIR.
Tell GTK applications to use the Wayland backend:
export GDK_BACKEND=wayland
Tell Qt applications to use the Wayland platform plugin:
export QT_QPA_PLATFORM=wayland
Tell SDL2 applications to use Wayland:
export SDL_VIDEODRIVER=wayland
Enable native Wayland rendering in Firefox:
export MOZ_ENABLE_WAYLAND=1
Enable Wayland rendering in Electron applications such as VS Code:
export ELECTRON_OZONE_PLATFORM_HINT=wayland
Enable Wayland rendering in Chromium and Chromium-based browsers:
export CHROMIUM_FLAGS="--ozone-platform=wayland"
export LIBSEAT_BACKEND=seatd
Most GTK3, GTK4, and Qt5/Qt6 applications support Wayland natively. Applications still using older toolkits or hardcoded X11 calls will run through XWayland automatically as long as XWayland is installed and enabled.
Terminal emulators with native Wayland support available in mports include:
foot — a lightweight, fast terminal designed for Waylandalacritty — a GPU-accelerated terminal with Wayland supportkitty — a feature-rich GPU terminal with Wayland supportApplication launchers compatible with Wayland:
wofi — a Wayland-native launcher similar to rofibemenu — a Wayland-compatible dynamic menu library and programfuzzel — a lightweight application launcher for WaylandStatus bars for use with sway and other wlroots compositors:
waybar — a highly customizable Wayland barswaybar — the built-in status bar included with swayScreen capture and screenshot tools:
grim — a screenshot tool for Wayland compositorsslurp — select a region on a Wayland display (used with grim)wf-recorder — screen recording for wlroots-based compositorsClipboard management:
wl-clipboard — provides wl-copy and wl-paste
command-line clipboard tools for WaylandIf the compositor exits immediately with an error about DRM or KMS, the GPU kernel module may not be loaded. Verify with:
ls /dev/dri/
dmesg | grep drm
If /dev/dri/ is empty, load the appropriate module manually and check
for errors:
kldload i915kms
dmesg | tail -20
Ensure your user is a member of the video group and that seatd is
running. Group changes require logging out and back in to take effect.
id
service seatd status
The directory must exist, be owned by your user, and have mode 700. Check with:
ls -ld /var/run/user/$(id -u)
If it is missing, create it:
mkdir -p /var/run/user/$(id -u) && chmod 700 /var/run/user/$(id -u)
Ensure XWayland is installed and that the compositor has started it. Check for a Wayland socket and an X display socket in the runtime directory:
ls $XDG_RUNTIME_DIR
You should see both wayland-0 and a file like .X0-lock
when XWayland is running.
Start sway with debug logging to diagnose startup failures:
sway -d 2> ~/sway-debug.log
For weston, verbose output is enabled with:
weston --log=~/weston.log