sites

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

dwm-hide_vacant_tags-git-20160626-7af4d43.diff (1424B)


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