X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/2c0d1cc87bf084ed3f1cdb4be881fb4f64f5773a..78b050c13c8ea660ed801c21bddd2957a2bc3f40:/tag.c?ds=inline diff --git a/tag.c b/tag.c index c4d3b34..a718ebd 100644 --- a/tag.c +++ b/tag.c @@ -34,16 +34,6 @@ void (*arrange)(Arg *) = DEFMODE; /* extern */ -void -appendtag(Arg *arg) -{ - if(!sel) - return; - - sel->tags[arg->i] = True; - arrange(NULL); -} - void dofloat(Arg *arg) { @@ -182,19 +172,6 @@ isvisible(Client *c) return False; } -void -replacetag(Arg *arg) -{ - int i; - - if(!sel) - return; - - for(i = 0; i < ntags; i++) - sel->tags[i] = False; - appendtag(arg); -} - void restack() { @@ -280,6 +257,22 @@ settags(Client *c) c->tags[i] = seltag[i]; } +void +tag(Arg *arg) +{ + unsigned int i; + + if(!sel) + return; + + for(i = 0; i < ntags; i++) + sel->tags[i] = False; + sel->tags[arg->i] = True; + settitle(sel); + if(!isvisible(sel)) + arrange(NULL); +} + void togglemode(Arg *arg) { @@ -288,24 +281,42 @@ togglemode(Arg *arg) } void -view(Arg *arg) +toggletag(Arg *arg) { unsigned int i; - for(i = 0; i < ntags; i++) - seltag[i] = False; - seltag[arg->i] = True; - arrange(NULL); + if(!sel) + return; + + sel->tags[arg->i] = !sel->tags[arg->i]; + for(i = 0; i < ntags && !sel->tags[i]; i++); + if(i == ntags) + sel->tags[arg->i] = True; + settitle(sel); + if(!isvisible(sel)) + arrange(NULL); } + void toggleview(Arg *arg) { unsigned int i; seltag[arg->i] = !seltag[arg->i]; - for(i = 0; !seltag[i] && i < ntags; i++); + for(i = 0; i < ntags && !seltag[i]; i++); if(i == ntags) seltag[arg->i] = True; /* cannot toggle last view */ arrange(NULL); } + +void +view(Arg *arg) +{ + unsigned int i; + + for(i = 0; i < ntags; i++) + seltag[i] = False; + seltag[arg->i] = True; + arrange(NULL); +}