added fullgaps

This commit is contained in:
Bryson Steck 2022-02-07 12:42:39 -07:00
parent 3425d4bda4
commit 1647a70ea6
2 changed files with 29 additions and 12 deletions

4
.gitignore vendored
View file

@ -1,2 +1,6 @@
*.o *.o
/patches /patches
dwm
*.orig
*.rej
*.1

37
dwm.c
View file

@ -122,6 +122,7 @@ struct Monitor {
int ty; /* tab bar geometry */ int ty; /* tab bar geometry */
int mx, my, mw, mh; /* screen size */ int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */ int wx, wy, ww, wh; /* window area */
int gappx;
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
unsigned int tagset[2]; unsigned int tagset[2];
@ -211,6 +212,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state); static void setclientstate(Client *c, long state);
static void setfocus(Client *c); static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
@ -674,6 +676,7 @@ createmon(void)
m->showbar = showbar; m->showbar = showbar;
m->showtab = showtab; m->showtab = showtab;
m->topbar = topbar; m->topbar = topbar;
m->gappx = gappx;
m->toptab = toptab; m->toptab = toptab;
m->ntabs = 0; m->ntabs = 0;
m->lt[0] = &layouts[0]; m->lt[0] = &layouts[0];
@ -1657,6 +1660,16 @@ setfullscreen(Client *c, int fullscreen)
} }
} }
void
setgaps(const Arg *arg)
{
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
selmon->gappx = 0;
else
selmon->gappx += arg->i;
arrange(selmon);
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@ -1834,7 +1847,7 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
unsigned int i, n, h, r, g = 0, mw, my, ty; unsigned int i, n, h, mw, my, ty;
Client *c; Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@ -1842,20 +1855,20 @@ tile(Monitor *m)
return; return;
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0; mw = m->nmaster ? m->ww * m->mfact : 0;
else else
mw = m->ww; mw = m->ww - m->gappx;
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) { if (i < m->nmaster) {
r = MIN(n, m->nmaster) - i; h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
h = (m->wh - my - gappx * (r - 1)) / r; resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); if (my + HEIGHT(c) + m->gappx < m->wh)
my += HEIGHT(c) + gappx; my += HEIGHT(c) + m->gappx;
} else { } else {
r = n - i; h = (m->wh - ty) / (n - i) - m->gappx;
h = (m->wh - ty - gappx * (r - 1)) / r; resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h -(2*c->bw), 0);
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) + m->gappx < m->wh)
ty += HEIGHT(c) + gappx; ty += HEIGHT(c) + m->gappx;
} }
} }