How to determine which window manager is running

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?


If you have wmctrl installed, the first line of output from command

wmctrl -m

will show you the name of the window manager. If you don't have wmctrl installed, use the following command to install it:

sudo apt-get install wmctrl

Note, man wmctrl (that is, the man page for wmctrl) says in part:

-m Display information about the window manager ...

On my Ubuntu 11.10 / Linux 3.0.0-14-generic #23-Ubuntu x86_64 / metacity 2.34.1 system, the first line of output from wmctrl -m was: Name: Metacity
while echo $DESKTOP_SESSION showed ubuntu-2d and echo $XDG_CURRENT_DESKTOP showed Unity.

On a fresh Ubuntu 15.10 install of Ubuntu desktop software on an old laptop, the first line of output from wmctrl -m was: Name: Compiz
while the DESKTOP_SESSION and XDG_CURRENT_DESKTOP values were ubuntu and Unity


On Linux systems I tested environment variables XDG_CURRENT_DESKTOP and GDMSESSION and got the following results.

You can use this line to get the output:

printf 'Desktop: %s\nSession: %s\n' "$XDG_CURRENT_DESKTOP" "$GDMSESSION"

Ubuntu 18.04 and 20.04 (Ubuntu on GNOME)

  • XDG_CURRENT_DESKTOP=ubuntu:GNOME
  • GDMSESSION=ubuntu

Ubuntu 18.04 (Ubuntu on Wayland)

  • XDG_CURRENT_DESKTOP=ubuntu:GNOME
  • GDMSESSION=ubuntu-wayland

Ubuntu 16.04

Unity (7)

  • XDG_CURRENT_DESKTOP=Unity
  • GDMSESSION=ubuntu

Ubuntu 14.04

Unity running with Mir

  • XDG_CURRENT_DESKTOP=Unity
  • GDMSESSION=ubuntu

Note MIR_SERVER_NAME is also set

  • MIR_SERVER_NAME=session-$NUMBER

Unity running without Mir

  • XDG_CURRENT_DESKTOP=Unity
  • GDMSESSION=ubuntu

XFCE

  • XDG_CURRENT_DESKTOP=XFCE
  • GDMSESSION=xfce

Ubuntu 12.04

KDE

  • XDG_CURRENT_DESKTOP=
  • GDMSESSION=kde-plasma

Unity 3D

  • XDG_CURRENT_DESKTOP=Unity
  • GDMSESSION=ubuntu

Unity 2D

  • XDG_CURRENT_DESKTOP=Unity
  • GDMSESSION=ubuntu-2d

Gnome

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=gnome-shell

Gnome Classic

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=gnome-classic

Gnome Classic (no effects)

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=gnome-fallback

Other Ubuntu based distributions

Mint 13 (Cinnamon)

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=cinnamon

Mint 16 (KDE edition)

  • XDG_CURRENT_DESKTOP=KDE
  • GDMSESSION=default

Mint 17 (Cinnamon)

  • XDG_CURRENT_DESKTOP=X-Cinnamon
  • GDMSESSION=default

Lubuntu 12.04

  • XDG_CURRENT_DESKTOP=LXDE
  • GDMSESSION=Lubuntu

Wasta 14.04 / 18.04

  • XDG_CURRENT_DESKTOP=X-Cinnamon
  • GDMSESSION=cinnamon

Wasta 14.04 using Gnome desktop.

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=gnome

Ubuntu Mate 18.04

  • XDG_CURRENT_DESKTOP=MATE
  • GDMSESSION=mate

Xubuntu 18.04

  • XDG_CURRENT_DESKTOP=XFCE
  • GDMSESSION=xubuntu

Kali Linux kali-rolling 2020.2

  • XDG_CURRENT_DESKTOP=GNOME
  • GDMSESSION=lightdm-xsession