Re: [dev] [dwm] adding WM_WINDOW_ROLE rule

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Mon, 26 Jul 2010 20:35:47 -0400

On Tue, Jul 27, 2010 at 01:11:05AM +0100, Rob wrote:
>On 27 July 2010 00:53, Ethan Grammatikidis <eekee57_AT_fastmail.fm> wrote:
>...
>> An idea crossed my mind, I don't know if it's worth anything. I thought of
>> adding a pair of fields to dwm's window-matching array to match any X
>> property set on a window. I don't know how the typing would work, perhaps it
>> could involve a pointer to a union? Also it could be a nuisance to those
>> with long window-matching lists.
>
>Crossed my mind too, but I would have no use of it and flexible arrays
>inside structures are a pain, so I didn't bother.
>If you have any ideas, I'd be interested, though, purely implementation-wise.

Not so much. There's quite easy if you allow C99, anyway.

typedef struct {
        char *class;
        char *regex;
        int ord;
} Prop;

struct {
        char *Rule;
        RuleFn fn;
        RuleArg arg;
} rules[] = {
        { (Rule[]){ {"WM_CLASS", "foo", 1}, {"WM_NAME", "bar"}, {0}},
          retag, { .s = "baz" } },
};

Or something to that effect. Although a macro to wrap up the
simple cases would probably help.

-- 
Kris Maglione
It is difficult to get a man to understand something when his salary
depends on his not understanding it.
	--Upton Sinclair
Received on Tue Jul 27 2010 - 02:35:47 CEST

This archive was generated by hypermail 2.2.0 : Tue Jul 27 2010 - 02:48:01 CEST