Re: [dwm] use of class and instance (was: Re: dwm-4.9 / dmenu-3.6)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri, 4 Apr 2008 10:49:37 +0200

On Fri, Apr 04, 2008 at 08:31:11AM +0200, Matthias Kirschner wrote:
> I saw that also Rule rules changed. And the gimp example is also
> different between 4.9 and hg.
>
> In dwm 4.9:
>
> { "Gimp", NULL, NULL, NULL, True },
>
> And in dwm hg:
>
> { NULL, NULL, "Gimp", NULL, True },

Well, the latter version is not present in hg. config.def.h is
like in 4.9 I think.

Anyways. if you use xprop(1) to gather the window properties
have a look to the WM_CLASS property, for Gimp windows it looks
like:

WM_CLASS(STRING) = "gimp", "Gimp"

Rules are expected the following way:

Rule rules[] = {
        /* class */ /* instance */ /* title */ /* tags ref */ /* isfloating */
        { "Gimp", "gimp", NULL, NULL, True }
        ...
};

So the first pattern should be a substring of the actual window
class (which is the second argument in WM_CLASS presented by xprop(1)),
the second pattern should be a substring of the actual window
instance (which is the first argument in WM_CLASS presented by xprop(1)),
the third pattern should be a substring of the actual window
title.

Usually the class/instance never changes and is fixed to all
windows of a certain application, the title is the more dynamic
thing -- but unless you do not re-apply the rules using Mod1-r
during runtime, they are only applied at the creation time of a
window, so it is safe for example to use xterm -title "bla" and
match for "bla" in the rules in the title.

If either value is NULL it is not checked or not applied.

Hope this helps,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Fri Apr 04 2008 - 10:49:37 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:31:04 UTC