dwm-gaps-6.1.diff (1802B)
1 diff -Naur a/config.def.h b/config.def.h 2 --- a/config.def.h Sun Jan 6 22:18:53 2019 3 +++ b/config.def.h Sun Jan 6 22:20:36 2019 4 @@ -5,6 +5,7 @@ 5 static const unsigned int snap = 32; /* snap pixel */ 6 static const int showbar = 1; /* 0 means no bar */ 7 static const int topbar = 1; /* 0 means bottom bar */ 8 +static const unsigned int gappx = 1; /* gap pixel between windows */ 9 static const char *fonts[] = { "monospace:size=10" }; 10 static const char dmenufont[] = "monospace:size=10"; 11 static const char col_gray1[] = "#222222"; 12 diff -Naur a/dwm.c b/dwm.c 13 --- a/dwm.c Sun Jan 6 22:18:53 2019 14 +++ b/dwm.c Sun Jan 6 22:25:03 2019 15 @@ -1673,7 +1673,7 @@ 16 void 17 tile(Monitor *m) 18 { 19 - unsigned int i, n, h, mw, my, ty; 20 + unsigned int i, n, h, r, g = 0, mw, my, ty; 21 Client *c; 22 23 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 24 @@ -1681,18 +1681,20 @@ 25 return; 26 27 if (n > m->nmaster) 28 - mw = m->nmaster ? m->ww * m->mfact : 0; 29 + mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0; 30 else 31 mw = m->ww; 32 for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 33 if (i < m->nmaster) { 34 - h = (m->wh - my) / (MIN(n, m->nmaster) - i); 35 + r = MIN(n, m->nmaster) - i; 36 + h = (m->wh - my - gappx * (r - 1)) / r; 37 resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); 38 - my += HEIGHT(c); 39 + my += HEIGHT(c) + gappx; 40 } else { 41 - h = (m->wh - ty) / (n - i); 42 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); 43 - ty += HEIGHT(c); 44 + r = n - i; 45 + h = (m->wh - ty - gappx * (r - 1)) / r; 46 + resize(c, m->wx + mw + g, m->wy + ty, m->ww - mw - g - (2*c->bw), h - (2*c->bw), False); 47 + ty += HEIGHT(c) + gappx; 48 } 49 } 50