diff options
author | ZachIR <zachir@librem.one> | 2021-12-22 22:07:36 +0000 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2021-12-22 22:07:36 +0000 |
commit | a92c8d43ba488d1e89bec2d223b084bce9e9bdd0 (patch) | |
tree | edbe6757f2d5ef0d5ed6aea360b1c080f32c906d /tcl.c | |
parent | cb3f58ad06993f7ef3a7d8f61468012e2b786cab (diff) | |
parent | e40da607bb373b53be74fd721e237fb796c65ab2 (diff) |
Merge branch 'master' into 'dwm-6.2'
update repo to new configs
See merge request zachir/dwm!1
Diffstat (limited to 'tcl.c')
-rw-r--r-- | tcl.c | 74 |
1 files changed, 74 insertions, 0 deletions
@@ -0,0 +1,74 @@ +void +tcl(Monitor * m) +{ + int x, y, h, w, mw, sw, bdw; + unsigned int i, n; + Client * c; + + for (n = 0, c = nexttiled(m->clients); c; + c = nexttiled(c->next), n++); + + if (n == 0) + return; + + c = nexttiled(m->clients); + + mw = m->mfact * m->ww; + sw = (m->ww - mw) / 2; + bdw = (2 * c->bw); + resize(c, + n < 3 ? m->wx : m->wx + sw, + m->wy, + n == 1 ? m->ww - bdw : mw - bdw, + m->wh - bdw, + False); + + if (--n == 0) + return; + + w = (m->ww - mw) / ((n > 1) + 1); + c = nexttiled(c->next); + + if (n > 1) + { + x = m->wx + ((n > 1) ? mw + sw : mw); + y = m->wy; + h = m->wh / (n / 2); + + if (h < bh) + h = m->wh; + + for (i = 0; c && i < n / 2; c = nexttiled(c->next), i++) + { + resize(c, + x, + y, + w - bdw, + (i + 1 == n / 2) ? m->wy + m->wh - y - bdw : h - bdw, + False); + + if (h != m->wh) + y = c->y + HEIGHT(c); + } + } + + x = (n + 1 / 2) == 1 ? mw : m->wx; + y = m->wy; + h = m->wh / ((n + 1) / 2); + + if (h < bh) + h = m->wh; + + for (i = 0; c; c = nexttiled(c->next), i++) + { + resize(c, + x, + y, + (i + 1 == (n + 1) / 2) ? w - bdw : w - bdw, + (i + 1 == (n + 1) / 2) ? m->wy + m->wh - y - bdw : h - bdw, + False); + + if (h != m->wh) + y = c->y + HEIGHT(c); + } +} |