mark broken clients as broken

keyboard
anselm@x200s.config 16 years ago
parent fc21dd4b7e
commit 8dc9fcf1b9
  1. 10
      dwm.c

10
dwm.c

@ -237,6 +237,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
/* variables */ /* variables */
static const char broken[] = "broken";
static char stext[256], ntext[8]; static char stext[256], ntext[8];
static int screen; static int screen;
static int sw, sh; /* X display screen geometry width, height */ static int sw, sh; /* X display screen geometry width, height */
@ -275,6 +276,7 @@ struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1
/* function implementations */ /* function implementations */
void void
applyrules(Client *c) { applyrules(Client *c) {
const char *class, *instance;
unsigned int i; unsigned int i;
const Rule *r; const Rule *r;
Monitor *m; Monitor *m;
@ -283,11 +285,13 @@ applyrules(Client *c) {
/* rule matching */ /* rule matching */
c->isfloating = c->tags = 0; c->isfloating = c->tags = 0;
if(XGetClassHint(dpy, c->win, &ch)) { 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++) { for(i = 0; i < LENGTH(rules); i++) {
r = &rules[i]; r = &rules[i];
if((!r->title || strstr(c->name, r->title)) if((!r->title || strstr(c->name, r->title))
&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) && (!r->class || strstr(class, r->class))
&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) && (!r->instance || strstr(instance, r->instance)))
{ {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->tags |= r->tags; c->tags |= r->tags;
@ -1819,6 +1823,8 @@ void
updatetitle(Client *c) { updatetitle(Client *c) {
if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
gettextprop(c->win, XA_WM_NAME, 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 void

Loading…
Cancel
Save