Check if KDE Plasma is currently running

What is the environment variable that’s always trusted (and will never change) to identify the current running desktop is KDE Plasma? Even if two or more desktops are installed on the same machine.

From my installation:

Wayland:

echo $DESKTOP_SESSION                                                                                                                                                          
plasmawayland
echo $XDG_CURRENT_DESKTOP                                                                                                                                                      
KDE

X11:

echo $DESKTOP_SESSION                                                                                                                                                          
plasma
echo $XDG_CURRENT_DESKTOP                                                                                                                                                      
KDE

It’s XDG_SESSION_DESKTOP.

See also linux - What is the difference between DESKTOP_SESSION, XDG_SESSION_DESKTOP, and XDG_CURRENT_DESKTOP? - Super User

1 Like