What Is Wayland on Linux, and How Is It Different From X? (2024)

Quick Links

  • What Is Wayland?

  • The Many Names of X

  • How X11 Works

  • How Wayland Works

  • Wayland's Slow Adoption by Applications

  • Are You Using Wayland or X11?

  • Should You Use Wayland or X11?

Key Takeaways

Wayland is a replacement windowing system for Linux distributions. It replaces the aging X11 standard. Because it requires applications to be modified to work with it, adoption has been slow so far. At the time of writing, increased security is the main advantage over X11.

X11, or the X Window System, lets your graphical desktop environment display and control windows. Wayland is a replacement for X11. It's designed to be faster and more secure. Here's what you need to know about them.

What Is Wayland?

Wayland is a modern replacement for X11, which has been the default windowing system on Linux for decades. Wayland is a communication protocol and that defines the messaging between an X Window display server and client applications. The Wayland project provides client and server libraries that enable applications to use the protocol.

The Wayland project was started by a Red Hat developer in 2008.

The Many Names of X

The X Window System is a windowing system, first released for the Unix operating by the Massachusetts Institute of Technology in 1984. Applications can build on the functionality offered by the windowing system to generate user interfaces.

By 1987 the X Window System had reached version 11, and became known as X11. It's now managed by the X.Org Foundation. It's still at version 11, although there have been many smaller releases since 1987. As of the time of writing, the current stable version is X11R7.7.

The "X" in the name doesn't signify ten in Roman numerals, nor does it imply "Xtra", "Xtended" or anything like that. A previous windowing system was called "W", for "windows", and they simply moved to the next letter in the alphabet when they started the new project.

You'll hear the X Window System referred to as "X", "X11", "Xorg", "X Windows", and the "X Window System."

How X11 Works

The X Window System handles low-level events and primitives, such as interacting with the mouse, and drawing and moving windows. The applications handle the visuals and the interface design. The appearance of the windows, what buttons they have, and where those button are located, are choices the application programmer makes. The X Window System draws the resulting design to the screen.

X11 provides a definition for the communication that has to pass between the various components of a working X Window System. This communication is required because the code that an X-enabled application uses to draw its windows and interface elements isn't inside the application. That work is shared between an X server and the Window Manager.

Applications are clients of the X server. The Window Manager is a special type of client. The X server is in charge of managing resources, executing drawing requests, and marshaling events such as key presses and mouse clicks to the appropriate applications.

It also acts as the middleman in communication between the Window Manager and the applications, brokering messages back and forth between them. The Window Manager maintains a list of the windows that applications have open, where they are on screen, what size they are, if they are over-lapping, and so on.

A compositing Window Manager maintains an off-screen buffer for each window. It composites these buffers into a single image that represents the top-most window---which represents the entire desktop---which is written to the screen.

All modern graphical desktop environments, including GNOME and KDE, use compositing Window Managers.

How Wayland Works

Wayland is intended to solve X11's problems. The X11 architecture requires a lot of messaging. The X server sits between the clients and the Window Manager. It also sits between everything and---via the kernel---the graphics hardware. The volume of messaging can lead to latency and a laggy, jumpy visual experience.

There's a large code base too. There's the server application, the Window Manager application, and the X11 library that clients use. The larger (and older) your code base is, the harder it is to maintain , and the more you will struggle with legacy code.

By changing the architecture, Wayland has modernized and streamlined the code base, giving performance benefits and improved security.

In effect, they've merged the server and the Window manager into one application. They removed any code that performed functions that are now performed by the kernel. Instead of replicating the effort, they leveraged the functionality of the kernel.

With Wayland, the compositor and the client application communicate directly. The compositor maintains its internal mapping of which windows are where on the desktop, and what size and state they're in. It brokers keyboard, mouse, and window change events, and sends them to the applications that own those windows.

The applications update the user interface accordingly. A major difference is that the rendering is performed inside the applications themselves, using the linked Wayland libraries.

The application either updates the buffer used to hold the window, or creates a new one and discards the old one. The client application then sends notification to the compositor, telling it to update its window mapping and to use the new or updated video buffer.

This simplified architecture and modern code design deliver performance improvements, with window resizes and drags in particular, appearing smooth and fluid.

Wayland's Slow Adoption by Applications

Wayland is the default windowing system in Debian 10 and newer, Fedora 34 or newer, Ubuntu 18.04 or newer, and other distributions such as Arch Linux. Despite this, more often than not, Wayland runs X11 applications.

There's a compatibility layer called XWayland that allows X11 applications to run under Wayland. This was required because the majority of X11 applications haven't been modified and ported to Wayland.

On desktop environments that provide Wayland compositors, like GNOME, official applications such as GNOME Text Editor and Maps, Files, and Calendar are all Wayland native applications. But the vast majority of X11 applications are still untouched, native, X11 applications.

Related: Nvidia Releases Open-Source Linux GPU Drivers, With a Catch

The XWayland middleware usually works just fine, but there can be issues with some X11 applications that perform low level screen-related functions such as screen recording. Using Wayland with NVIDIA can be just as much a pain as it is with X11, although I've had no issues on my daily driver using it with an NVIDIA GeForce GT 1030 GPU.

Some authors of X11 applications are likely to be hoping their application works fine with XWayland, and they can avoid having to rework them into Wayland applications. Don't be surprised if the uptake and migration to Wayland is long and slow, with new applications adopting it but the majority of existing X11 applications staying as they are, pinning their hopes on XWayland.

Related: What's New in Ubuntu 21.04 'Hirsute Hippo'

Are You Using Wayland or X11?

If you're using one of the major Linux distributions, the chances are you're already using Wayland. You can check by issuing the following command.


On a system using Wayland, the output will be:

What Is Wayland on Linux, and How Is It Different From X? (1)

And on a system running the X Window System, you'll see:

What Is Wayland on Linux, and How Is It Different From X? (2)

Rarely, the XDG_SESSION_TYPE environment variable is not set. In that case you can use this command instead:

loginctl show-session $(loginctl show-user $(whoami) -p Display --value) -p Type --value

The inner, nested loginctl command uses the show-user command to show properties of the named user. The whoami command gives us the name of the current user. The -p (property) option restricts the output from loginctl to information about the "Display" setting, and we use the --value option to return only the value. We don't want to have the "Display=" string in the response from loginctl . All of that gives us a session ID.

We pass the session ID to the outer loginctl , and use the show-session command to display attributes of the session. We use the -p (property) option to restrict the output to information about the session type, and use the --value option to show the value without the "Type=" label.

On a computer using Wayland, you'll see:

What Is Wayland on Linux, and How Is It Different From X? (3)

If you're running the X Window System, you'll see:

What Is Wayland on Linux, and How Is It Different From X? (4)

Should You Use Wayland or X11?

Unless you're having issues, you may as well stick with what your already using. But if you're noticing instabilities or jerky screen updates, you can try moving to whichever one you're not using.

On GNOME, if you want to swap over and try the other system, at the login screen click your user name and then click the gear wheel icon in the bottom-right corner of the display.

What Is Wayland on Linux, and How Is It Different From X? (5)

A menu will offer you different versions of GNOME. Options that mention "Xorg" use the X Window System and those that don't use Wayland.

Related: How to List Environment Variables on Linux

What Is Wayland on Linux, and How Is It Different From X? (2024)
Top Articles
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 6713

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.