feat: hide vacant tags patch

This commit is contained in:
Arthur Khachaturov 2024-08-01 19:01:33 +03:00
parent 8fe685e02e
commit bb0af060e5
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55

20
dwm.c
View file

@ -546,9 +546,14 @@ buttonpress(XEvent *e)
i = 0;
x = TEXTW(mwsymbol);
do
unsigned int occ = 0;
for(c = m->clients; c; c=c->next)
occ |= c->tags[metaws] == TAGMASK ? 0 : c->tags[metaws];
do {
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 (ev->x < TEXTW(mwsymbol))
click = ClkMwSymbol;
@ -839,7 +844,7 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
occ |= c->tags[metaws];
occ |= c->tags[metaws] == TAGMASK ? 0 : c->tags[metaws];
if (c->isurgent)
urg |= c->tags[metaws];
}
@ -848,13 +853,14 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, mwsymbol, 0);
for (i = 0; i < LENGTH(tags); i++) {
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);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags[metaws] & 1 << i,
urg & 1 << i);
if (occ & 1 << i && m == selmon &&
selmon->sel && selmon->sel->tags[metaws] & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw, 1, urg & 1 << i);
x += w;
}