Wayland or x11?

Chester Wyke December 23, 2024 Updated: April 15, 2025 #debian

How to know which you are using

Source: https://unix.stackexchange.com/questions/202891/how-to-know-whether-wayland-or-x11-is-being-used

Based on an error message in the rust winit crate I think the easiest way to check is see if either of the environment variables WAYLAND_DISPLAY or WAYLAND_SOCKET is set. And the environment variable DISPLAY should be set if you are on x11. So…

You get output on at least one of this if you are on Wayland:

echo $WAYLAND_DISPLAY
echo $WAYLAND_SOCKET

And you should get output on this if you are on x11:

echo $DISPLAY

The actual instruction from the site are to run

loginctl

Then take the value under session in the first column and insert into <SESSION> in the next command

loginctl show-session <SESSION> -p Type