diff --git a/config.h b/config.h index aed4dea..bacf3b4 100644 --- a/config.h +++ b/config.h @@ -2,6 +2,7 @@ /* appearance */ static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int gappx = 18; /* gaps between windows */ static const unsigned int snap = 16; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ diff --git a/dwm.c b/dwm.c index a1ffdd3..0f97bd2 100644 --- a/dwm.c +++ b/dwm.c @@ -809,17 +809,6 @@ drawbar(Monitor *m) } drw_setscheme(drw, scheme[SchemeInfoNorm]); drw_rect(drw, x, 0, w, bh, 1, 1); - /* - if (m->sel) { - drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); - if (m->sel->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); - } else { - drw_setscheme(drw, scheme[SchemeInfoNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); - } - */ } drw_map(drw, m->barwin, 0, 0, m->ww, bh); } @@ -1754,26 +1743,29 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int i, n, h, mw, my, ty; + unsigned int i, n, h, mw, my, ty, ns; Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); if (n == 0) return; - if (n > m->nmaster) + if (n > m->nmaster) { mw = m->nmaster ? m->ww * m->mfact : 0; - else + ns = m->nmaster > 0 ? 2 : 1; + } else { mw = m->ww; + ns = 1; + } for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if (i < m->nmaster) { - h = (m->wh - my) / (MIN(n, m->nmaster) - i); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - my += HEIGHT(c); + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx; + resize(c, m->wx + gappx, m->wy + my + gappx, mw - (2*c->bw) - gappx * (5 - ns) / 2, h - (2*c->bw) - gappx, 0); + my += HEIGHT(c) + gappx; } else { h = (m->wh - ty) / (n - i); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); - ty += HEIGHT(c); + resize(c, m->wx + mw + gappx / ns, m->wy + ty + gappx, m->ww - mw - (2*c->bw) - gappx * (5 - ns) / 2, h - (2*c->bw) - gappx * 2, 0); + ty += HEIGHT(c) + gappx; } }