--- config.h Sat Sep 15 18:10:36 2007 +++ config.h Sat Sep 15 18:12:32 2007 @@ -26,6 +26,7 @@ static Layout layouts[] = { /* symbol function */ { "[]=", tile }, /* first entry is default */ { "><>", floating }, + { "TTT", bstack }, }; #define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ --- dwm.c Sat Sep 15 18:10:36 2007 +++ dwm.c Sat Sep 15 17:53:58 2007 @@ -177,6 +177,7 @@ static void tag(const char *arg); static unsigned int textnw(const char *text, unsigned int len); static unsigned int textw(const char *text); static void tile(void); +static void bstack(void); static void togglebar(const char *arg); static void togglefloating(const char *arg); static void togglemax(const char *arg); @@ -479,7 +480,7 @@ initbar(void) { XDefineCursor(dpy, barwin, cursor[CurNormal]); updatebarpos(); XMapRaised(dpy, barwin); - strcpy(stext, "dwm-"VERSION); + strlcpy(stext, "dwm-"VERSION, sizeof(stext)); dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); dc.gc = XCreateGC(dpy, root, 0, 0); XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); @@ -1723,7 +1724,7 @@ static void setmwfact(const char *arg) { double delta; - if(!isarrange(tile)) + if(!isarrange(tile) && !isarrange(bstack)) return; /* arg handling, manipulate mwfact */ if(arg == NULL) @@ -1780,11 +1781,48 @@ tile(void) { } } +void +bstack(void) { + unsigned int i, n, nx, ny, nw, nh, mh, tw, th; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + + /* window geoms */ + mh = (n > 1) ? (wah * mwfact) / 1 : wah / (n > 0 ? n : 1); + th = (n > 1) ? (wah * (1 - mwfact)) / 1 : 0; + tw = (n > 1) ? waw / (n - 1) : 0; + + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) { + c->ismax = False; + nx = wax; + ny = way; + if(i < 1) { + ny += i * mh; + nw = waw - 2 * c->border; + nh = mh - 2 * c->border; + } + else { + nx += (i - 1) * tw; + ny += mh * 1; + if(i + 1 == n) { /* remainder */ + nw = (wax + waw) - nx - 2 * c->border; + } + else { + nw = tw - 2 * c->border; + } + nh = th - 2 * c->border + 1; + } + resize(c, nx, ny, nw, nh, RESIZEHINTS); + } +} + static void zoom(const char *arg) { Client *c; - if(!sel || !isarrange(tile) || sel->isfloating) + if(!sel || (!isarrange(tile) && !isarrange(bstack)) || sel->isfloating) return; if((c = sel) == nexttiled(clients)) if(!(c = nexttiled(c->next)))