Detect window manager using KWindowSystem

Thomas Lübking thomas.luebking at gmail.com
Sat Oct 18 14:34:53 BST 2014


On Freitag, 17. Oktober 2014 14:56:16 CEST, Paulo Lieuthier wrote:

> I'm now trying to check if there is an active window manager, 
> for lxqt-session. That's what I'm doing:
>
>     NETRootInfo rootInfo(QX11Info::connection(), NET::Supported);
>     qDebug() << "SupportingWMCheck: " <<
>     rootInfo.isSupported(NET::SupportingWMCheck);
>
> That appears to be the correct way to check it

NETWM spec:
-------------------------------------------
NET_SUPPORTING_WM_CHECK, WINDOW/32
The Window Manager MUST set this property on the root window to be the ID of a child window created by himself, to indicate that a compliant window manager is active. The child window MUST also have the _NET_SUPPORTING_WM_CHECK property set to the ID of the child window. The child window MUST also have the _NET_WM_NAME property set to the name of the Window Manager.

Rationale: The child window is used to distinguish an active Window Manager from a stale _NET_SUPPORTING_WM_CHECK property that happens to point to another window. If the _NET_SUPPORTING_WM_CHECK window on the client window is missing or not properly set, clients SHOULD assume that no conforming Window Manager is present.
-------------------------------------------

tl;dr:
-------
you must fetch the support window WId from the root property and check the property again on that window.
KWin does apparently not withdraw the root property (not even the support list), but isn't oblieged to do so either.

You MUST check the hinted support window anyway, because if the WM was killed -9 or -11 it will unlikely (in case of -9 "no way") have withdrawn any root property and your findings based upon this data alone would be wrong.

There's no convenience function for that in KWindowSystem, is there?
(I don't see it)

Cheers,
Thomas




More information about the kde-core-devel mailing list