Hi all.

For a personal choose i usually put all the secondary things at the top
of the screen mantaining the current working area at the bottom. For
this reason i thought would be nice to do the same thing with dvtm and i
hacked the ``bottom stack'' layout in order to make it works exactly as
the contrary; from here the ``top stack'' layout. I found it very useful
expecially when i have only three maximized clients (often). The code
works but i will not surprise to find bugs.

I hope someone will found it helpful.

-- 
Claudio M. Alessi

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU d-@ s: a--> C++(+++) UB++>$ P+> !L E--- W++(+++)
N+@ o--> K? w+@> O-@> M- V? PS+@ PE+@ Y+ PGP> t(-)@ 5?
X+ R? tv-- b+> DI-- D? G e+@> h--@> r y*
------END GEEK CODE BLOCK------

diff -Nwur dvtm.orig/config.h dvtm.wip/config.h
--- dvtm.orig/config.h	2008-02-26 19:19:53.653584435 +0100
+++ dvtm.wip/config.h	2008-02-26 20:38:21.831827186 +0100
@@ -42,12 +42,14 @@
 
 #include "tile.c"
 #include "grid.c"
+#include "tstack.c"
 #include "bstack.c"
 #include "fullscreen.c"
 
 Layout layouts[] = {
 	{ "[]=", tile },
 	{ "+++", grid },
+	{ "LLL", tstack },
 	{ "TTT", bstack },
 	{ "[ ]", fullscreen },
 };
@@ -64,6 +66,7 @@
 	{ MOD, 'k', { focusprev,      { NULL }    } },
 	{ MOD, 't', { setlayout,      { "[]=" }   } },
 	{ MOD, 'g', { setlayout,      { "+++" }   } },
+	{ MOD, 'B', { setlayout,      { "LLL" }   } },
 	{ MOD, 'b', { setlayout,      { "TTT" }   } },
 	{ MOD, 'm', { setlayout,      { "[ ]" }   } },
 	{ MOD, ' ', { setlayout,      { NULL }    } },
diff -Nwur dvtm.orig/dvtm.c dvtm.wip/dvtm.c
--- dvtm.orig/dvtm.c	2008-02-26 19:19:53.685586435 +0100
+++ dvtm.wip/dvtm.c	2008-02-26 19:25:49.271809187 +0100
@@ -403,7 +403,7 @@
 setmwfact(const char *args[]) {
 	double delta;
 
-	if(!isarrange(tile) && !isarrange(bstack))
+	if( ! (isarrange(tile) || isarrange(tstack) || isarrange(bstack)) )
 		return;
 	/* arg handling, manipulate mwfact */
 	if(args[0] == NULL)
Binary files dvtm.orig/.git/index and dvtm.wip/.git/index differ
diff -Nwur dvtm.orig/Makefile dvtm.wip/Makefile
--- dvtm.orig/Makefile	2008-02-26 19:19:53.649584185 +0100
+++ dvtm.wip/Makefile	2008-02-26 20:37:52.794012436 +0100
@@ -35,7 +35,7 @@
 	@echo creating dist tarball
 	@mkdir -p dvtm-${VERSION}
 	@cp -R LICENSE Makefile README config.h config.mk \
-		${SRC} tile.c bstack.c grid.c fullscreen.c \
+		${SRC} tile.c tstack.c bstack.c grid.c fullscreen.c \
 		madtty.h dvtm-status dvtm.1 dvtm-${VERSION}
 	@tar -cf dvtm-${VERSION}.tar dvtm-${VERSION}
 	@gzip dvtm-${VERSION}.tar
diff -Nwur dvtm.orig/tstack.c dvtm.wip/tstack.c
--- dvtm.orig/tstack.c	1970-01-01 01:00:00.000000000 +0100
+++ dvtm.wip/tstack.c	2008-02-26 19:18:12.171242185 +0100
@@ -0,0 +1,53 @@
+void
+tstack(void) {
+	unsigned int i, m, n, nx, ny, nw, nh, mh, tw;
+	Client *c;
+
+	for(n = 0, m = 0, c = clients; c; c = c->next, n++)
+		if(c->minimized)
+			m++;
+
+	/* relative height */
+	mh = (wah - m) * (n == 1 || n - 1 == m ? 1 : mwfact);
+
+	/* true if there are at least 2 non minimized clients */
+	if(n - 1 > m)
+		tw = waw / (n - m - 1);
+
+	nx = wax, nw = waw;
+	for(i = 0, c = clients; c; c = c->next, i++){
+		if(i == 0){ /* master */
+			ny = wah - mh;
+			nh = mh;
+		} else { /* tile window */
+			if(i == 1){
+				nx = wax;
+				ny = way + m;
+				nh = wah - mh - ny;
+			}
+			if(i == n - m - 1){ /* last not minimized client */
+				nw = (wax + waw) - nx;
+			} else if(i == n - m){ /* first minimized client */
+				nx = wax;
+				ny--;
+				nh = 1;
+				nw = waw;
+			} else if(c->minimized) { /* minimized window */
+				ny--;
+				nh = 1;
+				nw = waw;
+			} else /* normal non minimized tile window */
+				nw = tw;
+			if(i > 1 && !c->minimized){
+				mvvline(ny, nx, ACS_VLINE, nh);
+				mvaddch(ny, nx, ACS_TTEE);
+				nx++, nw--;
+			}
+		}
+
+		resize(c,nx,ny,nw,nh);
+
+		if(n > 1 && i < n - m - 1)
+			nx += nw;
+	}
+}

Reply via email to