diff -r e50c3eb0f55a config.def.h --- a/config.def.h Thu Oct 11 20:50:01 2007 +0200 +++ b/config.def.h Fri Oct 12 09:48:52 2007 +0200 @@ -22,7 +22,8 @@ Rule rules[] = { }; /* layout(s) */ -#define ISTILE isarrange(tile) /* || isarrange() */ +#include "fibonacci.h" +#define ISTILE (isarrange(tile) || isarrange(spiral) || isarrange(dwindle)) #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ #define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define SNAP 32 /* snap pixel */ @@ -30,6 +31,8 @@ Layout layouts[] = { /* symbol function */ { "[]=", tile }, /* first entry is default */ { "><>", floating }, + { "(@)", spiral }, /* fibonacci spiral */ + { "[\\]", dwindle }, /* fibonacci diagonal */ }; /* key definitions */ diff -r e50c3eb0f55a config.mk --- a/config.mk Thu Oct 11 20:50:01 2007 +0200 +++ b/config.mk Fri Oct 12 09:48:52 2007 +0200 @@ -2,6 +2,8 @@ VERSION = 4.6 VERSION = 4.6 # Customize below to fit your system + +SRC = fibonacci.c # paths PREFIX = /usr/local diff -r e50c3eb0f55a fibonacci.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fibonacci.c Fri Oct 12 09:48:52 2007 +0200 @@ -0,0 +1,67 @@ +/* See LICENSE file for copyright and license details. */ +#include "dwm.h" + +/* static */ + +static void +fibonacci(int shape) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + nx = wax; + ny = 0; + 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), i++) { + 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 && !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 = way; + } + resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False); + } + focus(NULL); + restack(); +} + +/* extern */ + +void +dwindle(void) { + fibonacci(1); +} + +void +spiral(void) { + fibonacci(0); +} diff -r e50c3eb0f55a fibonacci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fibonacci.h Fri Oct 12 09:48:52 2007 +0200 @@ -0,0 +1,3 @@ +/* fibonacci.c */ +void dwindle(void); /* arranges all windows in a fibonacci diagonal */ +void spiral(void); /* arranges all windows in a fibonacci spiral */