Check If You Are Using X11 or Wayland


If you are using Linux but are not sure which display server you are using (X11; Wayland), you can check your environment variables.



I don't think these variables are mutually exclusive. And it is worth checking for both.


If the WAYLAND_DISPLAY environment variable is present then the system is using Wayland.


I don't believe it is relevant what the values are. We're only interested if the variables are there or not.


In this example, DISPLAY is present. So, I am using X11.


Get-ChildItem Env: | Where-Object { $_.Name -match "(DISPLAY|WAYLAND_DISPLAY)" }

Name                           Value
----                           -----
DISPLAY                        :0.0


You will find other advice online relating to loginctl or $XDG_SESSION_TYPE. But there are problems with those answers. And checking the environment variables above avoids those problems.


References


How I can find out if a Linux system uses Wayland or X11? | Stack Overflow

Windowing system | Wikipedia

about Environment Variables | Microsoft Docs


Created: Wednesday, April 27, 2022

Updated: Wednesday, April 27, 2022



/gemlog/