I'm writing a program that needs to detect the name of the running Window Manager (for example, Compiz) on a Linux host running X11.
I'm currently relying on the Extended Window Manager Hints specification, which allows me to query _NET_SUPPORTING_WM_CHECK
through XGetWindowProperty
to get the ID of a Window
which I can then query (through another call to XGetWindowProperty
) for the _NET_WM_NAME
property:
if ((disp = XOpenDisplay(NULL)))
{
if (!(XGetWindowProperty(disp, DefaultRootWindow(disp), XInternAtom(disp, "_NET_SUPPORTING_WM_CHECK", True),
0, 1024, False, XA_WINDOW, &actual_type, &actual_format, &nitems, &bytes, (unsigned char **) &wm_check_window)))
{
if (!(XGetWindowProperty(disp, *wm_check_window, XInternAtom(disp, "_NET_WM_NAME", True),
0, 1024, False, XInternAtom(disp, "UTF8_STRING", True), &actual_type,
&actual_format, &nitems, &bytes, (unsigned char **) &wm_name)))
{
strncpy(str, (char *) wm_name, MAX_STRLEN);
XFree(wm_name);
}
}
}
This works surprisingly nicely for EWMH-compliant Window Managers, but it doesn't work at all for non-compliant ones. I've tried grabbing the WM_NAME
property on those, but that only contains the title (or something related to the title) of the active window.
Is there any way to get the actual name of the Window Manager through X11 without EWMH?