Add gaps to gaplessgrid layout

This commit is contained in:
BitHeaven-Official 2023-03-08 12:01:52 +05:00
parent 513ae0cc68
commit 90ea92628f
3 changed files with 3 additions and 3 deletions

BIN
dwm

Binary file not shown.

BIN
dwm.o

Binary file not shown.

View File

@ -44,16 +44,16 @@ gaplessgrid(Monitor *m) {
rows = n/cols;
/* window geometries */
cw = cols ? m->ww / cols : m->ww;
cw = cols ? (m->ww - m->gappx) / cols : m->ww - m->gappx;
cn = 0; /* current column number */
rn = 0; /* current row number */
for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
if(i/rows + 1 > cols - n%cols)
rows = n/cols + 1;
ch = rows ? m->wh / rows : m->wh;
ch = rows ? (m->wh - m->gappx) / rows : m->wh - m->gappx;
cx = m->wx + cn*cw;
cy = m->wy + rn*ch;
resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
resize(c, cx + m->gappx, cy + m->gappx, cw - 2 * c->bw - m->gappx, ch - 2 * c->bw - m->gappx, False);
rn++;
if(rn >= rows) {
rn = 0;