diff -u -N -r dwm-4.4/screen.c dwm-4.4.new/screen.c --- dwm-4.4/screen.c 2007-08-23 12:11:41.000000000 -0400 +++ dwm-4.4.new/screen.c 2007-08-23 19:44:39.000000000 -0400 @@ -51,6 +51,79 @@ resize(c, c->x, c->y, c->w, c->h, True); } +static void +spiral(void) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + nx = wax; + ny = way + wah; + nw = waw; + nh = wah; + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) { + c->ismax = False; + if((i % 2 && nh / 2 > 2 * c->border) + || (!(i % 2) && nw / 2 > 2 * c->border)) + { + if(i < n - 1) { + if(i % 2) + nh /= 2; + else + nw /= 2; + if((i % 4) == 2) + nx += nw; + else if((i % 4) == 3) + ny += nh; + } + if((i % 4) == 0) + ny -= nh; + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else + nx -= nw; + i++; + } + resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False); + } +} + +static void +grid(void) { + unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + + /* grid dimensions */ + for(rows = 0; rows <= n/2; rows++) + if(rows*rows >= n) + break; + cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows; + + /* window geoms (cell height/width) */ + ch = wah / (rows ? rows : 1); + cw = waw / (cols ? cols : 1); + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) { + c->ismax = False; + cx = (i / rows) * cw; + cy = (i % rows) * ch + (bpos == BarTop ? bh : 0); // bh? adjust + /* adjust height/width of last row/column's windows */ + ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0; + aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0; + resize(c, cx, cy, cw - 2 * c->border + aw, ch - 2 * c->border + ah, False); + i++; + } +} + + + + LAYOUTS /* extern */