diff -paur dwm.old/dwm.c dwm.new/dwm.c --- dwm.old/dwm.c 2013-03-13 19:14:34.591449951 +0100 +++ dwm.new/dwm.c 2013-03-13 19:15:02.795003870 +0100 @@ -426,7 +426,7 @@ attachstack(Client *c) { void buttonpress(XEvent *e) { - unsigned int i, x, click; + unsigned int i, x, click, occ = 0; Arg arg = {0}; Client *c; Monitor *m; @@ -440,10 +440,14 @@ buttonpress(XEvent *e) { focus(NULL); } if(ev->window == selmon->barwin) { + for(c = m->clients; c; c = c->next) { + occ |= c->tags; + } i = x = 0; - do + do { + if (!(m->tagset[m->seltags] & 1 << i) && !(occ & 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; @@ -722,11 +726,11 @@ drawbar(Monitor *m) { } dc.x = 0; for(i = 0; i < LENGTH(tags); i++) { + if (!(m->tagset[m->seltags] & 1 << i) && !(occ & 1 << i)) continue; dc.w = TEXTW(tags[i]); col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm; drawtext(tags[i], col, urg & 1 << i); - drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - occ & 1 << i, urg & 1 << i, col); + drawsquare(False, False, urg & 1 << i, col); dc.x += dc.w; } dc.w = blw = TEXTW(m->ltsymbol);