Difficulty: ☆☆☆☆☆
There are several ways to find it out.
The article covered:
- Desktop Environments (DE) of:
- Gnome;
- KDE.
- methods to get info:
- Graphical UI (GUI);
- Terminal UI (TUI):
- for visual reading;
- for usage in programming (to get a pure string value to use it in your scripts).
Methods using GUI
Gnome
- Open the settings application
- Select the option about
- Look for the
Windowing system
line where the options are:Wayland
orX11
KDE
Info Centre from Start menu
- Open Start menu.
- Navigate to
Info Centre
- GUI window will be opened. Check
Graphics Platform
field.
Info Centre GUI call from terminal emulator
- Open a terminal emulator.
- Type
kinfocenter about-distro
- GUI window will be opened. Check
Graphics Platform
field.
Methods using TUI
These was tested on Gnome, KDE:
$XDG_SESSION_TYPE environment variable
echo $XDG_SESSION_TYPE
Usage in programming
$XDG_SESSION_TYPE
Example:
echo "I use the ${XDG_SESSION_TYPE} user session type.";
Expected output:
I use the x11 user session type.
inxi - command line system information script for console and IRC
inxi -Gy1
And search for the Display
field value.
Usage in programming
inxi -Gy1 | grep "Display:" | awk '{print $2}'
Example:
session_type=$(inxi -Gy1 | grep "Display:" | awk '{print $2}');
echo "${session_type} is my current session type for now.";
Expected output:
x11 is my current session type for now.
loginctl - systemd login manager
It uses 2 steps to reach the goal, but it provide the way to check a user session type of other users in a system:
loginctl
get Session
ID of your user and paste it:
loginctl show-session user_session_id
And search for the Type
field value.
Usage in programming
session_id=$(loginctl session-status | head -n1 | awk '{print $1}');
session_type=$(loginctl show-session "${session_id}" -p Type --value);
Example:
session_id=$(loginctl session-status | head -n1 | awk '{print $1}');
session_type=$(loginctl show-session "${session_id}" -p Type --value);
echo "My session type is ${session_type}.";
Expected output:
My session type is wayland.
Note for an editor: the test case
Before to submit that section code, please test a possible case of real machine data output (username is m
):
$ loginctl
SESSION UID USER SEAT TTY
2 1000 m seat0 tty2
5 1000 m seat0
2 sessions listed.
$
Is that information still actual?
We don’t know and try to keep it up to date.
It was verified as worked on the Manjaro Linux OS.
DE edition | Verification date | Notes |
---|---|---|
Gnome | Oct-2021 | |
KDE | Oct-2021 |
Suggestions for that wiki post editors
They are:
-) please try to improve,
-) in the Is that information still actual
section please save any ordering, for example alphabetical by DE;
-) avoid partial verification if you are changing the verification date: if you want to update the Verification date
column value, please check that all mentioned methods of the DE you select is still works on that date. So the Verification date
value is the date then all the mentioned methods was checked and worked in the selected DE.
Possible keywords and key phrases for indexing engines
How to check a user session type (Wayland / X11) using on KDE GNOME.
Manjaro Linux terminal TUI command line CLI get session type KDE GNOME Wayland X11.