This commit is contained in:
Sky Hearn 2024-02-27 23:21:38 -08:00
parent 9f8855343c
commit 1a7ba5c479
Signed by: fallingsky04
GPG Key ID: DAB485883AE426EC
2 changed files with 13 additions and 9 deletions

View File

@ -2,6 +2,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappx = 10; /* gap pixel between windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */

21
dwm.c
View File

@ -1687,7 +1687,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
unsigned int i, n, h, mw, my, ty;
unsigned int i, n, h, r, g= 0, mw, my, ty;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@ -1695,20 +1695,23 @@ tile(Monitor *m)
return;
if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0;
mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0;
else
mw = m->ww;
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);
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);
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
if (my + HEIGHT(c) + gappx < m->wh)
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);
if (ty + HEIGHT(c) < m->wh)
ty += HEIGHT(c);
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);
if (ty + HEIGHT(c) + gappx < m->wh)
ty += HEIGHT(c) + gappx;
}
}