Re: [dwm] Patch to handle null X Class the way you want.

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue, 20 Feb 2007 15:21:47 +0100

On Tue, Feb 20, 2007 at 09:18:10AM -0500, John A. Grahor wrote:
> I have a number of in-house written X Clients that don't set the X res
> class and X res name properties making XGetClassHint return non-zero. I
> found that this short circuited the regular expression processing thus
> forcing all such clients to the default action vis. floating and/or
> tagging. I see this as a bug but you may not.
>
> It so happens that I want these clients to float and my default action
> is to tile.
>
> I am submitting the following patch which allows this. If XGetClassHint
> returns non zero it sets the test string to "::name" and normal regular
> expression processing proceeds. Now you can create a regular expression
> like "::.*" and send these clients where you want.
>
> By the way, I've only just tried dwm and I love it even more than wmii.
>
> Cheers,
> John
>
>

> diff -up dwm-3.3/tag.c dwm-my/tag.c
> --- dwm-3.3/tag.c 2007-02-01 02:22:55.000000000 -0500
> +++ dwm-my/tag.c 2007-02-08 18:10:24.000000000 -0500
> @@ -77,12 +77,15 @@ settags(Client *c, Client *trans) {
> regmatch_t tmp;
> Bool matched = trans != NULL;
> XClassHint ch;
> + ch.res_class = NULL;
> + ch.res_name = NULL;
>
> if(matched) {
> for(i = 0; i < ntags; i++)
> c->tags[i] = trans->tags[i];
> }
> - else if(XGetClassHint(dpy, c->win, &ch)) {
> + else {
> + XGetClassHint(dpy, c->win, &ch);
> snprintf(prop, sizeof prop, "%s:%s:%s",
> ch.res_class ? ch.res_class : "",
> ch.res_name ? ch.res_name : "", c->name);

FYI something similiar is in mainstream dwm since dwm-3.4.

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Tue Feb 20 2007 - 15:21:47 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:37:42 UTC