Is there any way (such as a command or environmental variable) to determine what window manager is the one actively running in the current session?
and on my Ubuntu 11.10 / Linux 3.0.0-14-generic #23-Ubuntu x86_64 / metacity 2.34.1 system,
On the same system,
On Linux systems I tested environment variables XDG_CURRENT_DESKTOP and GDMSESSION and got the following results:
Unity running with Mir
Note MIR_SERVER_NAME is also set
Unity running without Mir
Gnome Classic (no effects)
Other Ubuntu based distributions
Mint 13 (Cinnamon)
Mint 16 (KDE edition)
Mint 17 (Cinnamon)
In the terminal type
XDG_CURRENT_DESKTOP - Tells you what Windows Manager you are using
GDMSESSION - Tells you what option you selected from the lightdm greeter to login.
To use them, go to the terminal and type:
(Will output for example 'unity' if you are using Unity)
(Will output for example 'ubuntu' if you selected ubuntu in the login or 'ubuntu-2d' if you selected that one in the login.)
You have others if you look closer at the output of
Since what you are looking for is the name of what Window Manager is in usem the only way I see how to get this is by looking in the process list. To do this there is a command called
To look for other types, just change the word
I've been testing also with KDE and my conclusion is:
a) Graphical way, with HardInfo: the answer is normally in "Operating System" > "Desktop Environment", but if not you can look to "Environment variables". HardInfo is ready with all the tested distros, except the one with KDE, but it can be easily and quickly installed (only 2 packages in Linux Mint 13).
b) Command line, with this command:
The following script resulted as the best answer to a similar question I posted over at unix.se. It also works great with Unity and LXDE.
I can only think of checking for known window managers in the running processes. There used to be a key in gconf that was set to the preferred window manager, but its deprecated since Gnome 2.12.
So, if this is for a programming purpose, I suggest you to research for all the linux window managers; some popular are:
You would have to run a check for each with the command
I am not 100% sure if Gnome Shell is considered a window manager; the rest of the window managers I got from a list in the
Well @Anarci 's comment seems to be more accurate. In my case it did show
Here (MATE over Linux Mint) ...
echo $DESKTOP_SESSION ... returns ... default.desktop ---> Not valid
echo GDMSESSION ... returns ... GDMSESSION ---> Not valid
echo $XDG_CURRENT_DESKTOP ... returns ... (nothing) ---> Not valid
These 2 work for me:
A) 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, ...
B) In a terminal or console, run: pgrep -l "gnome|kde|mate|cinnamon" or ps -A | egrep -i "gnome|kde|mate|cinnamon" . The item that appears in more lines should be the answer
This command seems to be useful:
-> in GNOME returns
-> in MATE returns
-> in LXDE returns
-> in JWM returns
To know the version of the installed DE we can open Synaptic and put its name in the "Quick filter" box. Below "Installed Version" we have the answer. Next to it, below "Latest Version", we can see the highest to what we can update it to (at least if we have just clicked on "Reload" and considering only stable software -by default the access to the developing versions is usually disabled-). If instead of Synaptic the considered distro uses PackageKit or other a similar solution shoul be avaiable.