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

From: John A. Grahor <jag_AT_techma.com>
Date: Tue, 20 Feb 2007 09:18:10 -0500

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);
Received on Tue Feb 20 2007 - 15:18:20 UTC

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