diff -ruN dwm-5.0.1.orig/config.def.h dwm-5.0.1/config.def.h --- dwm-5.0.1.orig/config.def.h 2008-06-19 10:11:38.000000000 +0200 +++ dwm-5.0.1/config.def.h 2008-07-21 17:24:56.000000000 +0200 @@ -30,10 +30,13 @@ static float mfact = 0.55; static Bool resizehints = True; /* False means respect size hints in tiled resizals */ +#include "fibonacci.c" static Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ + { "(@)", spiral }, + { "[\\]", dwindle }, }; /* key definitions */ diff -ruN dwm-5.0.1.orig/fibonacci.c dwm-5.0.1/fibonacci.c --- dwm-5.0.1.orig/fibonacci.c 1970-01-01 01:00:00.000000000 +0100 +++ dwm-5.0.1/fibonacci.c 2008-07-21 17:24:21.000000000 +0200 @@ -0,0 +1,60 @@ +void +fibonacci(int s) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++) + if(n == 0) + return; + + nx = wx; + ny = 0; + nw = ww; + nh = wh; + + 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 && !s) + nx += nw; + else if((i % 4) == 3 && !s) + ny += nh; + } + if((i % 4) == 0) { + if(s) + 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(s) + nx += nw; + else + nx -= nw; + } + if(i == 0) + ny = wy; + i++; + } + resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); + } +} + +void +dwindle(void) { + fibonacci(1); +} + +void +spiral(void) { + fibonacci(0); +}