sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-hide_vacant_tags-6.4.diff (1366B)


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