Turns out I had some time for this tonight.  ;-)

Here's the diffs against the latest git.


diff -Naur dvtm/config.h dvtm-lstack/config.h
--- dvtm/config.h       2008-02-25 06:30:07.000000000 +0000
+++ dvtm-lstack/config.h        2008-02-25 06:37:02.000000000 +0000
@@ -43,6 +43,7 @@
 #include "tile.c"
 #include "grid.c"
 #include "bstack.c"
+#include "lstack.c"
 #include "fullscreen.c"
 
 Layout layouts[] = {
@@ -50,6 +51,7 @@
        { "+++", grid },
        { "TTT", bstack },
        { "[ ]", fullscreen },
+       { "=[]", lstack },
 };
 
 #define MOD CTRL('g')
@@ -63,6 +65,7 @@
        { MOD, 'i', { focusprevnm,    { NULL }    } },
        { MOD, 'k', { focusprev,      { NULL }    } },
        { MOD, 't', { setlayout,      { "[]=" }   } },
+       { MOD, 'T', { setlayout,      { "=[]" }   } },
        { MOD, 'g', { setlayout,      { "+++" }   } },
        { MOD, 'b', { setlayout,      { "TTT" }   } },
        { MOD, 'm', { setlayout,      { "[ ]" }   } },
diff -Naur dvtm/dvtm.c dvtm-lstack/dvtm.c
--- dvtm/dvtm.c 2008-02-25 06:30:07.000000000 +0000
+++ dvtm-lstack/dvtm.c  2008-02-25 06:22:55.000000000 +0000
@@ -403,7 +403,7 @@
 setmwfact(const char *args[]) {
        double delta;
 
-       if(!isarrange(tile) && !isarrange(bstack))
+       if(!isarrange(tile) && !isarrange(bstack) && !isarrange(lstack))
                return;
        /* arg handling, manipulate mwfact */
        if(args[0] == NULL)
diff -Naur dvtm/lstack.c dvtm-lstack/lstack.c
--- dvtm/lstack.c       1970-01-01 00:00:00.000000000 +0000
+++ dvtm-lstack/lstack.c        2008-02-25 06:22:55.000000000 +0000
@@ -0,0 +1,54 @@
+void
+lstack(void) {
+        unsigned int i, m, n, nx, ny, nw, nh, nm, mw, th;
+        Client *c;
+
+       /* number of minimized windows */
+        for(n = 0, m = 0, c = clients; c; c = c->next, n++)
+                if(c->minimized)
+                        m++;
+       /* number of nonminimized windows */
+        nm = n - m;
+        /* window geoms */
+        mw = (n == 1 || n - 1 == m) ? waw : waw * (1 - mwfact);
+        /* check if there are at least 2 non minimized clients */
+        if(n - 1 > m)
+                th = (wah - m) / (nm - 1); 
+
+        nx = wax;  
+        ny = way; 
+        for(i = 0, c = clients; c; c = c->next, i++) {
+                if(i == 0) { /* master */
+                        nw = mw;   
+                        nh = (n - 1 > m) ? wah : wah - m; 
+                        nx += waw - mw - 1;  
+                        mvvline(ny, nx, ACS_VLINE, wah);
+                        mvaddch(ny, nx, ACS_TTEE);
+                       nx++;
+                } else {  /* tile window */
+                        if(!c->minimized){
+                                if(i == 1) {
+                                       nx = wax;
+                                        ny = way;
+                                        nw = waw - mw - 1;
+                                }
+                                /* remainder */
+                               if(m == 0 && i + 1 == n) /* no minimized 
clients */
+                                        nh = (way + wah) - ny;
+                                else if(i == nm - 1) /* last not minimized 
client */
+                                        nh = (way + wah - (n - i - 1)) - ny;
+                                else
+                                        nh = th;
+                        } else {
+                                nh = 1;
+                                ny = way + wah - (n - i);
+                        }
+                        if(i > 1 && nm > 1)
+                                mvaddch(ny, wax + nw, ACS_RTEE);
+                }
+                resize(c,nx,ny,nw,nh);
+                if(n > 1 && th != wah)
+                        ny += nh;  
+        }
+}
+

Reply via email to