X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=tag.c;h=f6f4535a4fce7793ded49099ee67238edb2930e1;hb=57e6e3bb80b5fc4709de3f8b716a8b8065897c7a;hp=edf68c6d0c327154fdf56611eafc874a53452dea;hpb=aff4c787f484974fc01070842357548d7be395ce;p=dwm.git diff --git a/tag.c b/tag.c index edf68c6..f6f4535 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; - settitle(sel); -} - 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,21 @@ 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); + arrange(NULL); +} + void togglemode(Arg *arg) { @@ -288,24 +280,40 @@ 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); } + 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); +}