X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=tag.c;h=a2e1c8994d1ba5987a738c7a028769789347be19;hb=9d739090750ffb3b3a64e86e2331215b8901c360;hp=bc36f086eb2c892ce56e0bb5ef3da0cbcbce6d84;hpb=aa13727067af829b94461eb36aa029297ed8e6b9;p=dwm.git diff --git a/tag.c b/tag.c index bc36f08..a2e1c89 100644 --- a/tag.c +++ b/tag.c @@ -78,18 +78,18 @@ initrregs() void settags(Client *c) { - char classinst[256]; + char prop[512]; unsigned int i, j; regmatch_t tmp; Bool matched = False; XClassHint ch; if(XGetClassHint(dpy, c->win, &ch)) { - snprintf(classinst, sizeof(classinst), "%s:%s", + snprintf(prop, sizeof(prop), "%s:%s:%s", ch.res_class ? ch.res_class : "", - ch.res_name ? ch.res_name : ""); + ch.res_name ? ch.res_name : "", c->name); for(i = 0; !matched && i < len; i++) - if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { + if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) { c->isfloat = rule[i].isfloat; for(j = 0; rreg[i].tregex && j < ntags; j++) { if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { @@ -106,6 +106,8 @@ settags(Client *c) if(!matched) for(i = 0; i < ntags; i++) c->tags[i] = seltag[i]; + for(i = 0; i < ntags && !c->tags[i]; i++); + c->weight = i; } void @@ -122,6 +124,8 @@ tag(Arg *arg) settitle(sel); if(!isvisible(sel)) arrange(NULL); + else + drawstatus(); } void @@ -139,4 +143,6 @@ toggletag(Arg *arg) settitle(sel); if(!isvisible(sel)) arrange(NULL); + else + drawstatus(); }