Staff Ghost
Staff Ghost

Reputation:

Find the name of the X window manager

How do I find the name of the running X window window manager from a program?

If I start another window manager when one is already running, then an error occurs, so there must be a way for the other window manager to detect the first one.

How does it work?

Upvotes: 5

Views: 5461

Answers (3)

dkim
dkim

Reputation: 3970

The wmctrl command can display information about many EWMH/NetWM-compatible X window managers including their names:

$ wmctrl -m
Name: Compiz
...

Accroding to its Wikipedia page, it works with the following window managers at the present moment (Aug 2012):

  • blackbox >= 0.70
  • icewm
  • kwin (the default WM for KDE)
  • metacity (the default WM for GNOME)
  • openbox >= 3 (the default WM for Lubuntu)
  • sawfish
  • fvwm >= 2.5
  • waimea
  • pekwm
  • enlightenment >= 0.16.6
  • xfce >= 4
  • fluxbox >= 0.9.6
  • matchbox
  • window maker >= 0.91
  • compiz
  • awesome
  • wmfs

Upvotes: 3

ephemient
ephemient

Reputation: 204678

By the EWMH spec, a compliant window manager will set the _NET_SUPPORTING_WM_CHECK property on the root window to a window ID.

If the _NET_SUPPORTING_WM_CHECK property exists and contains the ID of an existing window, then a ICCCM2.0-compliant window manager is running. If the property exists but does not contain the ID of an existing window, then a ICCCM2.0-compliant window manager exited without proper cleanup. If the property does not exist, then no ICCCM2.0-compliant window manager is running.

That window (not the root window, but the one described by a property on the root window) should have a _NET_WM_NAME property on it, which is what you are looking for.

Upvotes: 11

Paul Tomblin
Paul Tomblin

Reputation: 182762

You may find an "atom" that has the information, but I don't think there is a 100% guarantee that all window managers use the same atom. Do an "xlsatoms" to list the atoms on your server, or "xprop" (and click) to see the properties (including atoms and their values) of a particular window.

Upvotes: 1

Related Questions