Add gaps to grid layout
This commit is contained in:
parent
5ffeb2af73
commit
513ae0cc68
4
dwm.c
4
dwm.c
|
@ -133,10 +133,10 @@ struct Monitor {
|
|||
int nmaster;
|
||||
int num;
|
||||
int by; /* bar geometry */
|
||||
int eby; /* bar geometry */
|
||||
int eby; /* bar geometry */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
int gappx;
|
||||
int gappx;
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
|
|
10
layouts.c
10
layouts.c
|
@ -13,15 +13,15 @@ grid(Monitor *m) {
|
|||
cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;
|
||||
|
||||
/* window geoms (cell height/width) */
|
||||
ch = m->wh / (rows ? rows : 1);
|
||||
cw = m->ww / (cols ? cols : 1);
|
||||
ch = (m->wh - m->gappx) / (rows ? rows : 1);
|
||||
cw = (m->ww - m->gappx) / (cols ? cols : 1);
|
||||
for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||
cx = m->wx + (i / rows) * cw;
|
||||
cy = m->wy + (i % rows) * ch;
|
||||
/* adjust height/width of last row/column's windows */
|
||||
ah = ((i + 1) % rows == 0) ? m->wh - ch * rows : 0;
|
||||
aw = (i >= rows * (cols - 1)) ? m->ww - cw * cols : 0;
|
||||
resize(c, cx, cy, cw - 2 * c->bw + aw, ch - 2 * c->bw + ah, False);
|
||||
ah = ((i + 1) % rows == 0) ? m->wh - m->gappx * (rows + 1) - ch * rows : 0;
|
||||
aw = (i >= rows * (cols - 1)) ? m->ww - m->gappx * (cols + 1) - cw * cols : 0;
|
||||
resize(c, cx + m->gappx * (i / rows + 1), cy + m->gappx * (i % rows + 1), cw - 2 * c->bw + aw, ch - 2 * c->bw + ah, False);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue