X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=tag.c;h=b7c06dea039a929f989b06acbf8ada704608e39b;hb=aa1bda81646e9d6188fd584009be0eee619f6966;hp=3a32c52135add1edf0c95efecf0b781a29961ce7;hpb=af1158d105ae10469c7a735fcba040b16cea0d60;p=dwm.git diff --git a/tag.c b/tag.c index 3a32c52..b7c06de 100644 --- a/tag.c +++ b/tag.c @@ -30,6 +30,17 @@ RULES static RReg *rreg = NULL; static unsigned int len = 0; +static void +commit() +{ + /* asserts sel != NULL */ + settitle(sel); + if(!isvisible(sel)) + arrange(NULL); + else + drawstatus(); +} + /* extern */ Client * @@ -106,6 +117,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 @@ -119,11 +132,7 @@ tag(Arg *arg) for(i = 0; i < ntags; i++) sel->tags[i] = False; sel->tags[arg->i] = True; - settitle(sel); - if(!isvisible(sel)) - arrange(NULL); - else - drawstatus(); + commit(); } void @@ -138,7 +147,5 @@ toggletag(Arg *arg) for(i = 0; i < ntags && !sel->tags[i]; i++); if(i == ntags) sel->tags[arg->i] = True; - settitle(sel); - if(!isvisible(sel)) - arrange(NULL); + commit(); }