t* dwm + patches URI git clone git://git.codevoid.de/dwm-sdk DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 1dafbf9fcabfac340a5c9c36b8a9b9b61b41945b DIR parent 5be974e0ca83cc0c67e9944550aa2832a3d14a7c URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de> Date: Thu, 18 Apr 2019 15:55:56 +0200 rework gaps to look nice Diffstat: M dwm.c | 39 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) --- DIR diff --git a/dwm.c b/dwm.c t@@ -1913,30 +1913,31 @@ tagmon(const Arg *arg) } void -tile(Monitor *m) -{ - unsigned int i, n, h, r, g = 0, mw, my, ty; +tile(Monitor *m) { + 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) + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if(n == 0) return; - if (n > m->nmaster) - mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0; - else + if (n > m->nmaster) { + mw = m->nmaster ? m->ww * m->mfact : 0; + ns = m->nmaster > 0 ? 2 : 1; + } else { mw = m->ww; - for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { - r = MIN(n, m->nmaster) - i; - h = (m->wh - my - gappx * (r - 1)) / r; - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - my += HEIGHT(c) + gappx; - } else { - r = n - i; - h = (m->wh - ty - gappx * (r - 1)) / r; - resize(c, m->wx + mw + g, m->wy + ty, m->ww - mw - g - (2*c->bw), h - (2*c->bw), False); - ty += HEIGHT(c) + gappx; + ns = 1; + } + for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if(i < m->nmaster) { + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx; + resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); + my += HEIGHT(c) + gappx; + } + else { + h = (m->wh - ty) / (n - i) - gappx; + 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); + ty += HEIGHT(c) + gappx; } }