X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dwm.c;h=553194d9bd8a31ee54400850d0868eb4be1b5388;hb=20996c6c5a0edbc9ebcb82e22520d04b789a9f0a;hp=4d1493b568cabc8487566296d96da0c1dee2d631;hpb=758b100d12ba1c52b5d7479e3ed334ba89e701f8;p=dwm.git diff --git a/dwm.c b/dwm.c index 4d1493b..553194d 100644 --- a/dwm.c +++ b/dwm.c @@ -237,6 +237,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); 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 @@ struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 /* function implementations */ void applyrules(Client *c) { + const char *class, *instance; unsigned int i; const Rule *r; Monitor *m; @@ -283,11 +285,13 @@ applyrules(Client *c) { /* 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; @@ -1052,6 +1056,7 @@ manage(Window w, XWindowAttributes *wa) { die("fatal: could not malloc() %u bytes\n", sizeof(Client)); *c = cz; c->win = w; + updatetitle(c); if(XGetTransientForHint(dpy, w, &trans)) t = wintoclient(trans); if(t) { @@ -1091,7 +1096,6 @@ manage(Window w, XWindowAttributes *wa) { updatesizehints(c); XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, False); - updatetitle(c); if(!c->isfloating) c->isfloating = trans != None || c->isfixed; if(c->isfloating) @@ -1819,6 +1823,8 @@ void 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