diff -r f330c3a2dc76 config.def.h --- a/config.def.h Tue Mar 25 09:41:14 2008 +0000 +++ b/config.def.h Thu Mar 27 15:02:00 2008 +0000 @@ -40,6 +40,8 @@ Layout layouts[] = { { "[]|", tileh, False }, { "><>", floating, True }, { "[M]", monocle, True }, + { "(@)", spiral, False }, + { "[\\]", dwindle, False }, }; /* key definitions */ diff -r f330c3a2dc76 dwm.c --- a/dwm.c Tue Mar 25 09:41:14 2008 +0000 +++ b/dwm.c Thu Mar 27 15:02:00 2008 +0000 @@ -185,6 +185,8 @@ unsigned int textnw(const char *text, un unsigned int textnw(const char *text, unsigned int len); unsigned int textw(const char *text); void tileh(void); +void spiral(void); +void dwindle(void); void tilehstack(unsigned int n); Client *tilemaster(unsigned int n); void tileresize(Client *c, int x, int y, int w, int h); @@ -1950,3 +1952,63 @@ main(int argc, char *argv[]) { XCloseDisplay(dpy); return 0; } +void +fibonacci(int shape) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + nx = wx; + ny = 0; + nw = ww; + nh = wh; + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) { + if((i % 2 && nh / 2 > 2 * c->bw) + || (!(i % 2) && nw / 2 > 2 * c->bw)) + { + if(i < n - 1) { + if(i % 2) + nh /= 2; + else + nw /= 2; + if((i % 4) == 2 && !shape) + nx += nw; + else if((i % 4) == 3 && !shape) + ny += nh; + } + if((i % 4) == 0) { + if(shape) + ny += nh; + else + ny -= nh; + } + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else if((i % 4) == 3) { + if(shape) + nx += nw; + else + nx -= nw; + } + if(i == 0) + ny = wy; + i++; + } + resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); + } + focus(NULL); + restack(); +} + +void +dwindle(void) { + fibonacci(1); +} + +void +spiral(void) { + fibonacci(0); +}