Skip to content
Tech News
← Back to articles

I hate: Programming Wayland applications

read original get Wayland Development Kit → more articles
Why This Matters

Programming Wayland applications presents unique challenges due to its modern architecture and compatibility issues, which can hinder development and user experience. Despite its potential benefits like improved security and streamlined design, the transition from X11 remains complex for developers and consumers alike, impacting the adoption of Wayland-based systems in the Linux ecosystem.

Key Takeaways

I Hate: Programming Wayland Applications

A quick introduction:

If you want to program a graphical application for linux, your primary choices are using either X11 or Wayland. According to Wikipedia, X11 had its first release in 1984. X11 follows a client-server-model. I assume it's because the whole computational environment, was very different back then. If you have a central server which is doing all of the heavy lifting, while the user only connects to it via a slim client / dumb terminals / whatever, having the desktop system follow a client-server-model makes sense. In contrast, Wayland (protocol) had its first release in 2008. That's also quite a while ago, in the 2000s the computational environment was probably much closer to what we have today: A PC usually comes with a desktop / graphical interface, and the machine doesn't need to rely on an external server to do most of the computing.

So, over the years there has been a push to switch from X11 to Wayland. And, at least on a surface level, this makes sense to me: Developers probably have learned a lot about the various requirements of desktops, so having a (mostly) clean cut for this new desktop environment seems promising. I have read claims stating that Wayland is inherently more secure than X11. Wayland isn't "outdated", we can design the desktop with performance and modern use-cases in mind.

I am typing this on a desktop machine running sway, which is a Wayland compositor. There definitely have been the common hurdles like desktop recording / sharing not working. But over time, these issues have been resolved - at least for my machine. Some years ago, I tried out both X11 and Wayland (I think back on Arch Linux). And honestly, the sway installation was far easier than the i3/X11 one. This ease of installation, combined with Wayland supposedly being "the future of Linux Desktops", and it supporting X11 applications via XWayland, made me stick to sway, even with its rough edges.

That was the story of me using Wayland. Now comes the developing part - which has been a fucking nightmare.

Foundational Differences

For libraries to be used by other developers, I'm a big fan of: Make easy things easy. Make hard things doable.

If you just want to open a window and do some simple rendering with your GPU, raylib is a fantastic library. Here is an example application:

#include <raylib.h> int main(void) { InitWindow(1280, 720, "Test Window"); SetTargetFPS(144); while ( ! WindowShouldClose()) { BeginDrawing(); ClearBackground(RAYWHITE); EndDrawing(); } return 0; }

... continue reading