diff -uNrp dwm.pertag/config.h dwm.full/config.h --- dwm.pertag/config.h 2007-09-19 13:08:52.000000000 +0100 +++ dwm.full/config.h 2007-09-20 11:26:45.000000000 +0100 @@ -25,6 +25,9 @@ Rule rules[] = { Layout layouts[] = { /* symbol function */ { "[]=", tile }, /* first entry is default */ + { "[=]", monocle }, + { "(@)", spiral }, + { "[\\]", dwindle }, { "><>", floating }, }; #define RESIZEHINTS True /* False - respect size hints in tiled resizals */ diff -uNrp dwm.pertag/dwm.c dwm.full/dwm.c --- dwm.pertag/dwm.c 2007-09-20 11:22:32.000000000 +0100 +++ dwm.full/dwm.c 2007-09-20 11:58:52.000000000 +0100 @@ -129,10 +129,12 @@ void detachstack(Client *c); void drawbar(void); void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]); void drawtext(const char *text, unsigned long col[ColLast]); +void dwindle(void); void *emallocz(unsigned int size); void enternotify(XEvent *e); void eprint(const char *errstr, ...); void expose(XEvent *e); +void fibonacci(int shape); void floating(void); /* default floating layout */ void focus(Client *c); void focusnext(const char *arg); @@ -154,6 +156,7 @@ void leavenotify(XEvent *e); void manage(Window w, XWindowAttributes *wa); void mappingnotify(XEvent *e); void maprequest(XEvent *e); +void monocle(void); void movemouse(Client *c); Client *nexttiled(Client *c); void propertynotify(XEvent *e); @@ -171,6 +174,7 @@ void setnmaster(const char *arg); void setnrows(const char *arg); void setup(void); void spawn(const char *arg); +void spiral(void); void tag(const char *arg); unsigned int textnw(const char *text, unsigned int len); unsigned int textw(const char *text); @@ -346,7 +350,7 @@ buttonpress(XEvent *e) { movemouse(c); } else if(ev->button == Button2) { - if(isarrange(tile) && !c->isfixed && c->isfloating) + if(!isarrange(floating) && !c->isfixed && c->isfloating) togglefloating(NULL); else zoom(NULL); @@ -639,6 +643,11 @@ drawtext(const char *text, unsigned long XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); } +void +dwindle(void) { + fibonacci(1); +} + void * emallocz(unsigned int size) { void *res = calloc(1, size); @@ -684,6 +693,44 @@ expose(XEvent *e) { } void +fibonacci(int shape) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + nx = wax; + ny = way + (shape ? -wah : 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), i++) { + c->ismax = False; + if((i % 2 ? nh : nw) > 4 * 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) + ny += shape ? nh : -nh; + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else if((i % 4) == 3) + nx += shape ? nw : -nw; + } + resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, RESIZEHINTS); + } +} + +void floating(void) { /* default floating layout */ Client *c; @@ -1087,6 +1134,14 @@ maprequest(XEvent *e) { } void +monocle(void) { + Client *c; + + for(c = nexttiled(clients); c; c = nexttiled(c->next)) + resize(c, wax, way, waw - 2*c->border, wah -2*c->border, RESIZEHINTS); +} + +void movemouse(Client *c) { int x1, y1, ocx, ocy, di, nx, ny; unsigned int dui; @@ -1616,6 +1671,11 @@ spawn(const char *arg) { } void +spiral(void) { + fibonacci(0); +} + +void tag(const char *arg) { unsigned int i; @@ -1974,7 +2034,8 @@ void zoom(const char *arg) { Client *c; - if(!sel || !isarrange(tile) || sel->isfloating) + if(!sel || sel->isfloating + || !(isarrange(tile) || isarrange(dwindle) || isarrange(spiral))) return; if((c = sel) == nexttiled(clients)) if(!(c = nexttiled(c->next)))