Wayland is a display server protocol. It specifies the communication between a display server and a client. It was made to replace the X window system because of its security, efficiency, and flexibility. It’s written in the C programming language.
Wayland isn’t an application that you can download or install. It’s a protocol that can be implemented in an environment. We will cover its mechanism later. First, let’s have a look at its history.
History of Wayland
Red Hat developer Kristian Høgsberg initiated the Wayland Project back in 2008. But the official release came out around 2010 when Linux graphics shifted to a more simplified system. It also became a part of freedesktop.org.
In the early releases, Wayland didn’t have any network transparency. In 2011, Høgsberg attempted to implement network transparency for Wayland but failed. He was still experimenting with it in 2013 using a proxy Wayland server.
Adam Jackson of Red Hat planned a pixel-scraping system similar to Virtual Network Computing for Wayland. Finally, in August 2017, GNOME successfully implemented a VNC server that worked under Wayland.
A fun fact. Wayland comes from the city of the same name in Massachusetts, United States.
How Does Wayland Work?
Before you know how Wayland works, you should first understand how X11 works for a better context.
X works based on a client-server model in which a central X display server talks to the hardware, the X clients, and the compositors. Say you want to open a window. Upon opening an application, the X server starts communicating with the compositors. They go back and forth until the compositor has all the necessary information about the window. It then sends the information to the X server and draws the window.
The X server now communicates with the application to tell it that the window is ready to serve. Finally, the application can display the content in the created window. This long process can produce some lags and delays.
Wayland works in a slightly different and simplified model. You don’t have a server. Rather, the compositors act as the server. The application communicates directly with the compositor to tell it about the window it wants to open.
The compositor receives all the necessary information from the application itself. The compositor then tells the application to draw the window to display its content. This is called client-side rendering.
Now, there’s a catch here. It an application is built originally for the X server, it can’t communicate with Wayland. To overcome this, we have XWayland. This backward compatibility layer allows X clients to run under a Wayland environment. With this, XWayland provides support to native X applications that haven’t received Wayland support yet.
What Are the Benefits of Wayland?
The goals of creating Wayland should be clear to you by now. Wayland solved many problems that X11 had. Some of its benefits include:
- Much less input delay. The moment you click something, it’s displayed in front of you. So graphical tasks such as window resizing look much smoother.
- Better performance. Since there are fewer steps to finish the whole displaying process, it performs better than X11.
- A leaner and streamlined codebase. Since Wayland is much more modern than Wayland, its new codebase and new architecture are easier to maintain and evolve.
All these benefits may entice you to use Wayland from now on. But you can’t forget that Xorg is much more established in the market because it’s been here for over thirty years. Many graphic intense applications such as video games run better on Xorg. Companies like Nvidia only support Xorg officially. Many developers are still creating applications and extensions to suite Xorg.
You need to consider all these before making the jump.
Which Linux Distros Use Wayland by Default?
In recent times, many distros have started to adopt Wayland as default.
- Fedora adopted Wayland since version 25 in November 2016 for the GNOME desktop. For the KDE desktop of Fedora, version 34 took Wayland as default in 2021.
- Red Hat Enterprise Linux comes with Wayland as default since version 8 in 2019.
- Debian opted for default Wayland since version 10 in 2019.
- Manjaro GNOME comes with Wayland since version 20.2 (Nibia) in 2020.
- Ubuntu Linux first shipped with Wayland on version 17.10 (Artful Aardvark). Due to some problems, they defaulted to XORG again for 18.04 LTS. Since the release of Ubuntu 21.04, Wayland was adopted as default again.
- Slackware Linux shipped with Wayland since version 15 in 2020.
As for Desktop Environments, GNOME, KDE Plasma 5, and Enlightenment are moving to Wayland.
GNOME 3.20 was to first version to include a full Wayland session. As time went on, they improved the support in each version.
KDE Plasma first experimented with Wayland in version 4.11. Version 5.4 came with full Wayland support.
Enlightenment e20 had full Wayland support in 2015
How to Know if You’re Using Wayland?
You can quickly check whether you’re using X or Wayland. Open your terminal and type in the following command:
As you may notice from the above screenshot, the system is using X11. If the above command doesn’t work for you, you can also try the below command:
loginctl show-session $(loginctl show-user $(whoami) -p Display --value) -p Type --value
We get the same output. But if you’re using a Wayland system instead, you should see the following output:
And for the second command:
Both outputs show us that the system is using Wayland.
How to Switch Between X11 and Wayland?
Using the commands we showcased above, you should first know what display server you’re using. If you’re using X11, you can switch to Wayland and vice-versa. The process is pretty simple.
If you’re running GNOME as your Desktop Environment, you get an option to switch between the two on your login screen. You can restart your system or log out to see the login screen. Then tap the gear icon at the bottom right corner of the screen. You should see a few options to choose from.
In our case, we’re using a system that uses Wayland by default. So the GNOME option that is selected contains it. To switch to X11 instead, we need to choose the GNOME Classic on Xorg or the GNOME on Xorg option.
Now you have a clear idea about what Wayland is. You also learned its brief history and why it was created. We summarized the mechanism behind Xorg and Wayland to show you some comparisons. Whether you’d like to stick to Xorg or Wayland is up to you. The best option we suggest is to stick to what came by default with your system unless you’re facing any graphical issues. In which case, you can switch to the non-default one.