Add vacant tags hiding patch

This commit is contained in:
Alex D. 2020-10-11 20:07:18 +02:00
parent 2ce7fd59f8
commit fdb631a4ad
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 11 additions and 2 deletions

13
dwm.c
View File

@ -437,9 +437,15 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
do
unsigned int occ = 0;
for(c = m->clients; c; c = c->next)
occ |= c->tags;
do {
/* do not reserve space for vacant tags */
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
x += TEXTW(tags[i]);
while (ev->x >= x && ++i < LENGTH(tags));
} while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@ -725,6 +731,9 @@ drawbar(Monitor *m)
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
/* do not draw vacant tags */
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);