mark broken clients as broken
8dc9fcf1
1 file(s) · +8 −2
| 237 | 237 | static void zoom(const Arg *arg); |
|
| 238 | 238 | ||
| 239 | 239 | /* variables */ |
|
| 240 | + | static const char broken[] = "broken"; |
|
| 240 | 241 | static char stext[256], ntext[8]; |
|
| 241 | 242 | static int screen; |
|
| 242 | 243 | static int sw, sh; /* X display screen geometry width, height */ |
|
| 275 | 276 | /* function implementations */ |
|
| 276 | 277 | void |
|
| 277 | 278 | applyrules(Client *c) { |
|
| 279 | + | const char *class, *instance; |
|
| 278 | 280 | unsigned int i; |
|
| 279 | 281 | const Rule *r; |
|
| 280 | 282 | Monitor *m; |
|
| 283 | 285 | /* rule matching */ |
|
| 284 | 286 | c->isfloating = c->tags = 0; |
|
| 285 | 287 | if(XGetClassHint(dpy, c->win, &ch)) { |
|
| 288 | + | class = ch.res_class ? ch.res_class : broken; |
|
| 289 | + | instance = ch.res_name ? ch.res_name : broken; |
|
| 286 | 290 | for(i = 0; i < LENGTH(rules); i++) { |
|
| 287 | 291 | r = &rules[i]; |
|
| 288 | 292 | if((!r->title || strstr(c->name, r->title)) |
|
| 289 | - | && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
|
| 290 | - | && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) |
|
| 293 | + | && (!r->class || strstr(class, r->class)) |
|
| 294 | + | && (!r->instance || strstr(instance, r->instance))) |
|
| 291 | 295 | { |
|
| 292 | 296 | c->isfloating = r->isfloating; |
|
| 293 | 297 | c->tags |= r->tags; |
|
| 1819 | 1823 | updatetitle(Client *c) { |
|
| 1820 | 1824 | if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) |
|
| 1821 | 1825 | gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); |
|
| 1826 | + | if(c->name[0] == '\0') /* hack to mark broken clients */ |
|
| 1827 | + | strcpy(c->name, broken); |
|
| 1822 | 1828 | } |
|
| 1823 | 1829 | ||
| 1824 | 1830 | void |
|