[hackers] [dwm] mark broken clients as broken || anselm

From: <hg_AT_suckless.org>
Date: Sun, 12 Jul 2009 20:49:25 +0000 (UTC)

changeset: 1460:606761ddf6d6
tag: tip
user: anselm_AT_x200s.config
date: Sun Jul 12 22:49:06 2009 +0100
files: dwm.c
description:
mark broken clients as broken

diff -r a5eecc6d674f -r 606761ddf6d6 dwm.c
--- a/dwm.c Sun Jul 12 22:34:29 2009 +0100
+++ b/dwm.c Sun Jul 12 22:49:06 2009 +0100
@@ -237,6 +237,7 @@
 static void zoom(const Arg *arg);
 
 /* variables */
+static const char broken[] = "broken";
 static char stext[256], ntext[8];
 static int screen;
 static int sw, sh; /* X display screen geometry width, height */
@@ -275,6 +276,7 @@
 /* function implementations */
 void
 applyrules(Client *c) {
+ const char *class, *instance;
         unsigned int i;
         const Rule *r;
         Monitor *m;
@@ -283,11 +285,13 @@
         /* rule matching */
         c->isfloating = c->tags = 0;
         if(XGetClassHint(dpy, c->win, &ch)) {
+ class = ch.res_class ? ch.res_class : broken;
+ instance = ch.res_name ? ch.res_name : broken;
                 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))))
+ && (!r->class || strstr(class, r->class))
+ && (!r->instance || strstr(instance, r->instance)))
                         {
                                 c->isfloating = r->isfloating;
                                 c->tags |= r->tags;
@@ -1819,6 +1823,8 @@
 updatetitle(Client *c) {
         if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
                 gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
+ if(c->name[0] == '\0') /* hack to mark broken clients */
+ strcpy(c->name, broken);
 }
 
 void
Received on Sun Jul 12 2009 - 20:49:25 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 12 2009 - 21:00:06 UTC