You can type
env to figure out what environments are configured.
The following response was found from this link
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 env like DESKTOP_SESSION and COMPIZ_CONFIG_PROFILE
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 pgrep ( Wikipedia ). I did the following to get the name since the parameter -l adds the process ID:
pgrep -l compiz |cut -d " " -f2 since the process is running by the same user there is no need to prefix the sudo part. You can then use this to create a script that does an action based on the Window Manager.
To look for other types, just change the word
compiz to another like
On Ubuntu 12.04 I tested environment variables XDG_CURRENT_DESKTOP and GDMSESSION and got the following results:
Gnome Classic no effects
Other Ubuntu based distributions:
Mint 13 (Cinnamon)