diff -r a98f0e8ea6cb dwm.c --- a/dwm.c Sat Feb 14 11:21:24 2009 +0000 +++ b/dwm.c Mon Feb 16 09:10:02 2009 -0500 @@ -257,21 +257,22 @@ void applyrules(Client *c) { - unsigned int i; + unsigned int i, xh=0; Rule *r; XClassHint ch = { 0 }; /* rule matching */ - if(XGetClassHint(dpy, c->win, &ch)) { - for(i = 0; i < LENGTH(rules); i++) { - r = &rules[i]; - if((!r->title || strstr(c->name, r->title)) - && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) - && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { - c->isfloating = r->isfloating; - c->tags |= r->tags & TAGMASK ? r->tags & TAGMASK : tagset[seltags]; - } + xh = XGetClassHint(dpy, c->win, &ch); + for(i = 0; i < LENGTH(rules); i++) { + r = &rules[i]; + if((!r->title || strstr(c->name, r->title)) + && (!r->class || (xh && ch.res_class && strstr(ch.res_class, r->class))) + && (!r->instance || (xh && ch.res_name && strstr(ch.res_name, r->instance)))) { + c->isfloating = r->isfloating; + c->tags |= r->tags & TAGMASK ? r->tags & TAGMASK : tagset[seltags]; } + } + if( xh ) { if(ch.res_class) XFree(ch.res_class); if(ch.res_name)