Wlroots

Jul 20, 2023

Modular Wayland compositor library

Pluggable, composable, unopinionated modules for building a Wayland compositor; or about 60,000 lines of code you were going to write anyway.

  • wlroots provides backends that abstract the underlying display and input hardware, including KMS/DRM, libinput, Wayland, X11, and headless backends, plus any custom backends you choose to write, which can all be created or destroyed at runtime and used in concert with each other.
  • wlroots provides unopinionated, mostly standalone implementations of many Wayland interfaces, both from wayland.xml and various protocol extensions. We also promote the standardization of portable extensions across many compositors.
  • wlroots provides several powerful, standalone, and optional tools that implement components common to many compositors, such as the arrangement of outputs in physical space.
  • wlroots provides an Xwayland abstraction that allows you to have excellent Xwayland support without worrying about writing your own X11 window manager on top of writing your compositor.
  • wlroots provides a renderer abstraction that simple compositors can use to avoid writing GL code directly, but which steps out of the way when your needs demand custom rendering code.

wlroots implements a huge variety of Wayland compositor features and implements them right, so you can focus on the features that make your compositor unique. By using wlroots, you get high performance, excellent hardware compatibility, broad support for many wayland interfaces, and comfortable development tools - or any subset of these features you like, because all of them work independently of one another and freely compose with anything you want to implement yourself.


The FreeBSD ports category x11-toolkits boasts of a port named wlroots – an essential component for managing protocols, surfaces, and outputs of Wayland compositors. In essence, Wayland wlroots is a modular backend for Wayland desktop sessions. If you are familiar with Xorg - the traditional display server, Wayland is its plausible alternative, known for its simplicity, efficiency, and security.

The key word to understand wlroots is modularity. It provides a set of building blocks that allows you to pick and select what you need, rather than giving an all-in-one monolithic framework.

This article will guide you on how to install and utilize the wlroots port on FreeBSD for a more flexible desktop environment.

Installing wlroots

The steps involved in the FreeBSD wlroots installation are generally straightforward. But before you start, make sure you have the latest version of FreeBSD installed on your system.

  1. First, update your FreeBSD system to the newest version
sudo freebsd-update fetch
sudo freebsd-update install
  1. Fetch and install the wlroots port

Make sure your Ports collection is up-to-date

sudo portsnap fetch update

Next, navigate to the x11-toolkits/wlroots port category

cd /usr/ports/x11-toolkits/wlroots

Finally, install wlroots

sudo make install clean

After installing wlroots, you will need to configure it correctly so it can run properly in your system.

Using wlroots

When you install wlroots, it doesn’t come with a compositor — it merely provides the tools necessary to build one. Compositors like sway, waymonad, or river can be built using wlroots. To use wlroots, you need to understand the basic architecture of Wayland.

In Wayland, a compositor is an exclusive display server running on your device serving the applications. Your applications don’t communicate directly to the display server in Wayland. Instead, they go through the Wayland protocol, which removes a lot of burden and provides added security.

You can utilize wlroots to create a custom compositor or use other premade ones based on wlroots. Sway is a popular wlroots-based Wayland compositor. If you’re familiar with i3 https//freebsdsoftware.org/x11-wm/i3.html, you can opt for Sway because it’s often seen as “i3 for Wayland.”

Here is how you install Sway on your FreeBSD machine

cd /usr/ports/x11-wm/sway
sudo make install clean

To then start Sway, simply type sway in your terminal.

Benefits of Using wlroots

  1. Modularity As stated earlier, wlroots delivers modular components that provide you with the flexibility to choose only what you need rather than opting for a complete package. This simplicity caters to a diverse range of needs and requirements.

  2. Efficiency By working directly on the hardware level bypassing the traditional X server, Wayland-based wlroots offers an efficient, resource-light solution for your graphical needs.

  3. Security With FreeBSD already renowned for its security, combining it with wlroots adds another layer to it. Since clients talk only through the Wayland protocol and not directly, potential threats can be mitigated.

  4. Compatibility Even if you decide to switch to a Wayland environment using wlroots, you will still be able to run X applications using XWayland, a program that provides backward compatibility for running X programs.

Conclusion

The wlroots FreeBSD port extends the functionality and enhances the adaptability of Wayland compositors. By offering modular components, it caters to a wide range of user requirements, whether you’re a system admin, a developer, or simply a FreeBSD enthusiast. Learning how to install and use it can provide an added layer of functionality and security to your FreeBSD experience. Remember, the learning curve might seem steep if you’re transitioning from Xorg, but the benefits of Wayland and wlroots are well worth the effort.


Checkout these related ports:
  • Ztoolkit - GUI toolkit heavily inspired by GTK
  • Xwallpaper - Xwallpaper utility allows you to set image files as your X wallpaper
  • Xview - X Window-System-based Visual/Integrated Environment for Workstations
  • Xview-clients - OpenLook applications and man pages
  • Xmhtml - Motif widget set for displaying HTML 3.2 documents
  • Xforms - Graphical user interface toolkit for X Window System
  • Xbae - Motif-based widget which displays a grid of cells as a spreadsheet
  • Wxgtk32 - GUI toolkit (wxWidgets) with ${FLAVORS/k/&+/tu} bindings
  • Wxgtk30 - The wxWidgets GUI toolkit with GTK+ bindings
  • Wmapp - DockApp Graphics Library
  • Wlroots015 - Modular Wayland compositor library (deprecated 0.15.* series)
  • Wlroots-devel - Modular Wayland compositor library (development snapshot)
  • Vte3 - Terminal widget with improved accessibility and I18N support
  • Vte -
  • Vte-reference -