WM_CLASS purpose?

Sanel Zukan sanelz at gmail.com
Sun Oct 21 21:43:19 PDT 2012


Hi,

> 1. What is WM_CLASS's purpose? I thought it's to find
>    X resources set by xrdb but Xrm* functions doesn't
>    seem to depend on it. Is there any specific purpose,
>    or does WM_CLASS have no specific purpose and just
>    stores the info that other apps/users decide on how to use it?

AFAIK it's purpose is to name resources from xrdb database so external
applications could read/modify it if app is using xrdb. From Xlib manual:

"... the name specified as part of WM_CLASS is the formal name of the
application that should be used when retrieving the application's
resources from the resource database."

> 2. Are there rules that an application should follow when
>    setting res_name and res_class?
>
>    For example, let's suppose I have a window manager
>    somebox that has taskbar, dock, menus for starting
>    applications/switching workspaces and configuration dialogs.
>    What should be res_name/res_class for each of them?
>
>    Accordng to manpage, res_name should be the application
>    name and res_class should be the application class. So all
>    the windows listed above should have the same
>    res_name="somebox", res_class="WindowManager". But many
>    apps I've seen don't seem to follow this logic. What's the
>    proper way to set WM_CLASS for the windows?

It is mostly convention and can depends on application needs; there
are no rules I'm aware of. For example, mrxvt will set 'mrxvt/XTerm'
and rxvt-unicode 'urxvt/URxvt', although both could set 'Term' or 'Rxvt'
as class name.

Also toolkits could set totally different stuff.

If you need to dig deeper, maybe you can ping wm-spec-list at gnome.org
or xorg devel list.

Regards,
Sanel


More information about the xdg mailing list