On Thu, 27 Mar 2008 13:35:14 +0100
pancake <[EMAIL PROTECTED]> wrote:
> can you publish the fibonacci for >=4.8 in the web?
>
I can give you a diff I made, see the attachment :)
diff -upN a/config.def.h b/config.def.h
--- a/config.def.h 2008-03-13 17:55:43.000000000 +0100
+++ b/config.def.h 2008-03-27 14:37:35.000000000 +0100
@@ -24,6 +24,7 @@ Rule rules[] = {
/* layout(s) */
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
#define SNAP 32 /* snap pixel */
+#include "fibonacci.c"
Layout layouts[] = {
/* symbol function isfloating */
@@ -31,6 +32,8 @@ Layout layouts[] = {
{ "[]|", tileh, False },
{ "><>", floating, True },
{ "[M]", monocle, True },
+ { "(@)", spiral, False },
+ { "[\\]", dwindle, False },
};
/* key definitions */
@@ -49,6 +52,8 @@ Key keys[] = {
{ MODKEY, XK_f, setlayout, "><>" },
{ MODKEY, XK_v, setlayout, "[]=" },
{ MODKEY, XK_h, setlayout, "[]|" },
+ { MODKEY, XK_s, setlayout, "(@)" },
+ { MODKEY, XK_d, setlayout, "[\\]"},
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL },
{ MODKEY|ShiftMask, XK_c, killclient, NULL },
{ MODKEY, XK_0, view, NULL },
diff -upN /dev/null b/fibonacci.c
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ b/fibonacci.c 2008-03-27 14:39:07.000000000 +0100
@@ -0,0 +1,60 @@
+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->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 = wy;
+ i++;
+ }
+ resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
+ }
+ focus(NULL);
+ restack();
+}
+
+void
+dwindle(void) {
+ fibonacci(1);
+}
+
+void
+spiral(void) {
+ fibonacci(0);
+}