dwm-tilegap-6.0.diff (2053B)
1 diff --git a/config.def.h b/config.def.h 2 index 77ff358..14d2826 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -9,6 +9,7 @@ static const char selbordercolor[] = "#005577"; 6 static const char selbgcolor[] = "#005577"; 7 static const char selfgcolor[] = "#eeeeee"; 8 static const unsigned int borderpx = 1; /* border pixel of windows */ 9 +static const unsigned int gappx = 18; /* gap pixel between windows */ 10 static const unsigned int snap = 32; /* snap pixel */ 11 static const Bool showbar = True; /* False means no bar */ 12 static const Bool topbar = True; /* False means bottom bar */ 13 diff --git a/dwm.c b/dwm.c 14 index 1d78655..41c72ff 100644 15 --- a/dwm.c 16 +++ b/dwm.c 17 @@ -1703,27 +1703,30 @@ textnw(const char *text, unsigned int len) { 18 19 void 20 tile(Monitor *m) { 21 - unsigned int i, n, h, mw, my, ty; 22 + unsigned int i, n, h, mw, my, ty, ns; 23 Client *c; 24 25 for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 26 if(n == 0) 27 return; 28 29 - if(n > m->nmaster) 30 + if (n > m->nmaster) { 31 mw = m->nmaster ? m->ww * m->mfact : 0; 32 - else 33 + ns = m->nmaster > 0 ? 2 : 1; 34 + } else { 35 mw = m->ww; 36 - for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 37 + ns = 1; 38 + } 39 + for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 40 if(i < m->nmaster) { 41 - h = (m->wh - my) / (MIN(n, m->nmaster) - i); 42 - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); 43 - my += HEIGHT(c); 44 + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx; 45 + resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); 46 + my += HEIGHT(c) + gappx; 47 } 48 else { 49 - h = (m->wh - ty) / (n - i); 50 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False); 51 - ty += HEIGHT(c); 52 + h = (m->wh - ty) / (n - i) - gappx; 53 + resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); 54 + ty += HEIGHT(c) + gappx; 55 } 56 } 57