Loading...
X

How to check if Wayland or X11 is used?

Table of contents

1. What is Wayland and X11

2. How to find out if you are using Wayland or X11 on the command line

2.1 Using the session ID

2.2 Checking the $XDG_SESSION_TYPE variable

2.3 Checking the WAYLAND_DISPLAY and DISPLAY variables

2.4 Finding Display Server environment variables

3. How to detect whether X11 or Wayland is being used in a GUI

3.1 How to see if GNOME is using X11 or Wayland

3.2 How to see if Cinnamon is using X11 or Wayland

3.3 How to see if KDE Plasma is using X11 or Wayland

3.4 How to see if X11 or Wayland is used in Xfce

4. Information about X11 or Wayland at hardinfo


What is Wayland and X11

The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.

X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface – this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces.

Wayland is a communication protocol that specifies the communication between a display server and its clients, as well as a C library implementation of that protocol. A display server using the Wayland protocol is called a Wayland compositor, because it additionally performs the task of a compositing window manager.

They are also collectively called “Windowing System” and “Display Server”, “Graphics Platform”.

In case you didn't understand, X11 and Wayland are required on Linux to run (display) graphical applications. At the same time, X11 and Wayland are mutually exclusive alternatives. First came X11, and then came Wayland.

Both X11 and Wayland have been criticized. X11 has been criticized for being cumbersome (in terms of functionality, as well as development and support). And Wayland has been criticized for its lack of compatibility with existing applications, new bugs and the lack of some features.

How to find out if you are using Wayland or X11 on the command line

As always with Linux, there are several ways to determine whether you are using X11 or Wayland.

1. Using the session ID

Get the session ID by running:

loginctl

It will show something like the following:

SESSION  UID USER SEAT  TTY  STATE  IDLE SINCE
      1 1000 mial seat0 tty2 active no   -    

1 sessions listed.

In this example, the session ID is “1”.

Then run a command like this:

loginctl show-session <SESSION_ID> -p Type

For example:

loginctl show-session 1 -p Type

If you prefer one command:

loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'

Another option based on the current username:

loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type

What is “Type=tty”

On some systems, when running the command

loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type

Instead of the expected values “Type=wayland” or “Type=x11” you might get the following output:

Type=tty

This means that this system (or the user who is logged in and on whose behalf the command is executed) does not use the graphical interface, but only uses the command line interface.

2. Checking the $XDG_SESSION_TYPE variable

This method looks simpler, but does not work for all Linux distributions.

Run the following command to see the value of the XDG_SESSION_TYPE variable:

echo $XDG_SESSION_TYPE

On X11 systems the output will be:

x11

On Wayland systems the output will be as follows:

wayland

On some distributions, the XDG_SESSION_TYPE variable is not set, so this method cannot be considered universal, but perhaps it will work and be more convenient for you.

3. Checking the WAYLAND_DISPLAY and DISPLAY variables

Check the value of the WAYLAND_DISPLAY variable:

echo $WAYLAND_DISPLAY

If something is output, for example “wayland-0”, then Wayland is used.

If nothing is output, then run the following command:

echo $DISPLAY

This method is not reliable if you start the test with the DISPLAY variable, since this variable is set when using XWayland.

But if the WAYLAND_DISPLAY variable does not have a value, but DISPLAY does, then this means that X11 is being used.

4. Finding Display Server environment variables

The environment variables associated with the Display Server can be found with the following command:

env | grep -E -i 'x11|xorg|wayland'

Output may vary on different systems.

Example output for X11:

XDG_SESSION_TYPE=x11

Example output for Wayland:

DESKTOP_SESSION=cinnamon-wayland
XDG_SESSION_TYPE=wayland
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.VC3OI2
WAYLAND_DISPLAY=wayland-0

How to detect whether X11 or Wayland is being used in a GUI

If you prefer a graphical interface, you can find information about the display server in the “About” / “System Info” item, which is usually found in the “System settings” application.

1. How to see if GNOME is using X11 or Wayland

Go to Settings → About → System Details → Windowing System.

2. How to see if Cinnamon is using X11 or Wayland

Press the “Menu” button and start typing “System Info”.

Or open “System settings” → “System Info”.

The information you are looking for is contained in the “Display Server” section.

Example for Wayland:

3. How to see if KDE Plasma is using X11 or Wayland

1. Click the Start menu and start typing “System Settings”, open the “System Settings” application.

2. Select the “About this System” tab and note the “Graphics Platform” label.

4. How to see if X11 or Wayland is used in Xfce

Xfce does not currently use Wayland. There is a fork of Xfce to port to Wayland, but it is still far from complete.

Information about X11 or Wayland at hardinfo

Install and run the hardinfo program.

Information about the display server can be found in Computer → Summary.

Or in Computer → Display:

See also: How to migrate from X11 to Wayland?


Leave Your Observation

Your email address will not be published. Required fields are marked *