Hi All,

On Thu, Mar 27, 2008 at 02:42:15PM +0100, Valentin wrote:
> 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 :)

i tried the patch on the dwm tip 1163, it didnt quite work for me,
attached is another diff that works for me, there is a border on the
bottom and top of desktops. but it works and is fine for me on a dual
head display.

the patch probably needs more work for those that are more fussy and
exact in what they want.

Jimmy
-- 
Jimmy Tang
Trinity Centre for High Performance Computing,
Lloyd Building, Trinity College Dublin, Dublin 2, Ireland.
http://www.tchpc.tcd.ie/ | http://www.tchpc.tcd.ie/~jtang
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);
+}

Attachment: pgpJ8kNGC77z6.pgp
Description: PGP signature

Reply via email to