--- vanilla/dwm.c 2011-07-04 11:09:51.000000000 +0200 +++ dwm/dwm.c 2011-07-04 11:09:50.000000000 +0200 @@ -53,6 +53,7 @@ #define HEIGHT(X) ((X)->h + 2 * (X)->bw) #define TAGMASK ((1 << LENGTH(tags)) - 1) #define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height) +#define ISTAGVISIBLE(M, OCC, I) (OCC & 1 << I || M->tagset[M->seltags] & 1 << I) /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ @@ -175,7 +176,6 @@ static void die(const char *errstr, ...) static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); -static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); static void drawtext(const char *text, unsigned long col[ColLast], Bool invert); static void enternotify(XEvent *e); static void expose(XEvent *e); @@ -735,12 +735,14 @@ drawbar(Monitor *m) { } dc.x = 0; for(i = 0; i < LENGTH(tags); i++) { - 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); - dc.x += dc.w; + /* Only show tags with clients or + * if it's current selected as viewable. */ + if (ISTAGVISIBLE(m, occ, i)) { + dc.w = TEXTW(tags[i]); + col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm; + drawtext(tags[i], col, urg & 1 << i); + dc.x += dc.w; + } } dc.w = blw = TEXTW(m->ltsymbol); drawtext(m->ltsymbol, dc.norm, False); @@ -762,7 +764,6 @@ drawbar(Monitor *m) { if(m->sel) { col = m == selmon ? dc.sel : dc.norm; drawtext(m->sel->name, col, False); - drawsquare(m->sel->isfixed, m->sel->isfloating, False, col); } else drawtext(NULL, dc.norm, False); @@ -780,18 +781,6 @@ drawbars(void) { } void -drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) { - int x; - - XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]); - x = (dc.font.ascent + dc.font.descent + 2) / 4; - if(filled) - XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1); - else if(empty) - XDrawRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x, x); -} - -void drawtext(const char *text, unsigned long col[ColLast], Bool invert) { char buf[256]; int i, x, y, h, len, olen; @@ -1132,7 +1121,7 @@ manage(Window w, XWindowAttributes *wa) /* only fix client y-offset, if the client center might cover the bar */ c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); - c->bw = borderpx; + c->bw = 0; } wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); @@ -1186,8 +1175,10 @@ monocle(Monitor *m) { n++; if(n > 0) /* override layout symbol */ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); - for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) - resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False); + for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) { + c->bw = 0; + resize(c, m->wx, m->wy, m->ww, m->wh, False); + } } void @@ -1302,6 +1293,7 @@ ptrtomon(int x, int y) { return m; return selmon; } + void quit(const Arg *arg) { running = False; @@ -1650,6 +1642,7 @@ tile(Monitor *m) { /* master */ c = nexttiled(m->clients); mw = m->mfact * m->ww; + c->bw = (n > 1 ? borderpx : 0); resize(c, m->wx, m->wy, (n == 1 ? m->ww : mw) - 2 * c->bw, m->wh - 2 * c->bw, False); if(--n == 0) return; @@ -1661,6 +1654,7 @@ tile(Monitor *m) { if(h < bh) h = m->wh; for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + c->bw = borderpx; resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False); if(h != m->wh)