a - GNOME under Linux Mint installed b - GNOME under Linux Mint Live USB c - MATE under Linux Mint d - LXDE under Lubuntu e - JWM under Puppy Linux (JWM is not a desktop environment but a stacking window manager). f - XFCE under Debian Buster
Results
env | grep DESKTOP_SESSION= (so-so)
a & b - DESKTOP_SESSION=gnome
c - DESKTOP_SESSION=default.desktop
d - DESKTOP_SESSION=Lubuntu
e - Nothing
f - DESKTOP_SESSION=xfce
echo $GDMSESSION (so-so)
a & b - gnome
c - Nothing
d - Lubuntu
e - Nothing
f - xfce
pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce|jwm" or ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm" (well, but not perfect)
a & b - OK
c - OK
d - WRONG
e - Nothing & OK
f - OK
HardInfo (very well, but not perfect)
a - Nothing
b - GNOME 2.32.0
c - MATE
d - LXDE (Lubuntu)
e - Unknown (Window Manager: JWM)
f - XFCE
Conclusion
A combination of HardInfo and the command ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm" probably will give the desired answer.
You can run HardInfo. It's ready by default at least in Linux Mint; or you could install it (from Synaptic, ...).
You can run it a) from the main menu > Search box > hardinfo, or b) from the main menu > All applications > System Tools or Administration > System Information, or c) from the main menu > All applications > All > System Information, or d) from a terminal or console > hardinfo > Enter, or e) from the Run Application dialog (Alt+F2) > hardinfo > Enter.
Once HardInfo opens you just need to need to click on the "Operating System" item and look to the "Desktop Environment" line.
Nowadays, apart from GNOME and KDE, you could find MATE, Cinnamon, ...
And you can try
$DESKTOP_SESSION
for the DE.This command seems to be useful:
/usr/bin/gnome-session
(and more)/usr/bin/mate-session
(and more)/usr/bin/lxsession
(and more)/usr/bin/icewm-session
(should be jwm-session, not?!)I've tested the best tools I've found with:
a - GNOME under Linux Mint installed
b - GNOME under Linux Mint Live USB
c - MATE under Linux Mint
d - LXDE under Lubuntu
e - JWM under Puppy Linux (JWM is not a desktop environment but a stacking window manager).
f - XFCE under Debian Buster
Results
env | grep DESKTOP_SESSION=
(so-so)echo $GDMSESSION
(so-so)pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
orps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
(well, but not perfect)HardInfo
(very well, but not perfect)Conclusion
A combination of
HardInfo
and the commandps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm"
probably will give the desired answer.For the window manager you can use:
In a terminal or console, you can run:
or
The item that appears in more lines should be the answer
You can run HardInfo. It's ready by default at least in Linux Mint; or you could install it (from Synaptic, ...).
You can run it a) from the main menu > Search box > hardinfo, or b) from the main menu > All applications > System Tools or Administration > System Information, or c) from the main menu > All applications > All > System Information, or d) from a terminal or console > hardinfo > Enter, or e) from the Run Application dialog (Alt+F2) > hardinfo > Enter.
Once HardInfo opens you just need to need to click on the "Operating System" item and look to the "Desktop Environment" line.
Nowadays, apart from GNOME and KDE, you could find MATE, Cinnamon, ...