dwm-hide_vacant_tags-6.3.diff (1157B)
1 diff --git a/dwm.c b/dwm.c 2 index a96f33c..f2da729 100644 3 --- a/dwm.c 4 +++ b/dwm.c 5 @@ -432,9 +432,15 @@ buttonpress(XEvent *e) 6 } 7 if (ev->window == selmon->barwin) { 8 i = x = 0; 9 - do 10 + unsigned int occ = 0; 11 + for(c = m->clients; c; c=c->next) 12 + occ |= c->tags; 13 + do { 14 + /* Do not reserve space for vacant tags */ 15 + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 16 + continue; 17 x += TEXTW(tags[i]); 18 - while (ev->x >= x && ++i < LENGTH(tags)); 19 + } while (ev->x >= x && ++i < LENGTH(tags)); 20 if (i < LENGTH(tags)) { 21 click = ClkTagBar; 22 arg.ui = 1 << i; 23 @@ -719,13 +725,12 @@ drawbar(Monitor *m) 24 } 25 x = 0; 26 for (i = 0; i < LENGTH(tags); i++) { 27 + /* Do not draw vacant tags */ 28 + if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 29 + continue; 30 w = TEXTW(tags[i]); 31 drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 32 drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 33 - if (occ & 1 << i) 34 - drw_rect(drw, x + boxs, boxs, boxw, boxw, 35 - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 36 - urg & 1 << i); 37 x += w; 38 } 39 w = blw = TEXTW(m->ltsymbol);