Re: WM_CLASS purpose?

Vladimir A. Pavlov pv4 at bk.ru
Wed Oct 31 12:43:39 PDT 2012


Wed, 31 Oct 2012 20:05:22 +0100 от Thomas Lübking <thomas.luebking at gmail.com>:
> On Mittwoch, 31. Oktober 2012 18:19:02 CEST, Vladimir A. Pavlov wrote:
> 
> > One more question: would it be correct to set only WM_WINDOW_ROLE
> > and not to set WM_CLASS, WM_CLIENT_LEADER, SM_CLIENT_ID?
> 
> No. It does *not* substitute any of those.

I understand it does not substitute them. But if I have a proper
WM_WINDOW_ROLE value I don't need WM_CLASS/etc at all.

I'm just searching a way to distinguish between taskbar and menu. AFAIU I
should set WM_CLASS to somebox/SomeBox (not, for example,
somebox/Menu or someboxmenu/SomeBox) for it so WM_CLASS wouldn't
help me here. So I see no reason to set WM_CLASS since the only property
that would help me is WM_WINDOW_ROLE.

I'd like to only set WM_WINDOW_ROLE and leave
WM_CLASS/WM_CLIENT_LEADER/etc empty to have as little code
as possible since I don't use those.

> In general you should provide the info you have to allow the WM to classify the client as good as possible, but this of course heavily depends on what you're doing there (ie. if i write me some testing X11 code to fire a window and do "sth." with it, i won't set any of those properties.)
> 
> WM_CLASS and WM_NAME are kind of "mandatory" for regular clients, esp. WM_CLASS allows WMs to autogroup clients on one VD, in a tab stack, navigate only inside this class etc.
> 
> The SM_CLIENT_ID is required on the window that is set as "WM_CLIENT_LEADER" by itself or other clients and this information is requried if you want to preserve window states across sessions (logout, login, autostart former present clients)

That's what I'm asking about.

If I set WM_CLIENT_LEADER for a window I _must_ set SM_CLIENT_ID
for it. But must I set anything for a window I set WM_WINDOW_ROLE for?
IOW is it an allowable situation when a window only have
WM_WINDOW_ROLE property and nothing else?

> Whether you want this depends on what client you write but should provided by a toolkit (in case you're writing such) and is supported by the "major" ones (Qt & Gtk+)

I'm working on a window manager, not a regular client. It can distinguish
between its windows (taskbar, menu, etc). And if I set menu role to
"somebox-menu" then external apps could detect window manager menu
as well and there would be no need in WM_CLASS/WM_NAME/etc.

My goal is to allow other applications to distinguish between windows
created by somebox by as little code as possible. I thought about setting
WM_CLASS but it appeared to be incorrect. Not I think about using
WM_WINDOW_ROLE so WM_CLASS is unnecessary for my task. But
what do the standards say about this?


More information about the xorg mailing list