--- a/config.def.h 2009-07-15 16:03:15.000000000 +0200 +++ b/config.def.h 2009-07-15 15:57:17.000000000 +0200 @@ -31,6 +30,7 @@ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "TTT", bstack }, }; /* key definitions */ --- a/dwm.c 2009-07-14 20:07:55.000000000 +0200 +++ b/dwm.c 2009-07-15 16:11:51.000000000 +0200 @@ -213,6 +213,7 @@ static void tagmon(const Arg *arg); static int textnw(const char *text, unsigned int len); static void tile(Monitor *); +static void bstack(Monitor *); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -1571,6 +1572,38 @@ } void +bstack(Monitor *m) { + int x, y, h, w, mh; + unsigned int i, n; + Client *c; + + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + + c = nexttiled(m->clients); + mh = m->mfact * m->wh; + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False); + + if(--n == 0) + return; + + x = m->wx; + y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh; + w = m->ww / n; + h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh; + if(h < bh) + h = m->wh; + + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, ((i + 1 == n) ? m->wx + m->ww - x : w) - 2 * c->bw, + h - 2 * c->bw, False); + if(w != m->ww) + x = c->x + WIDTH(c); + } +} + +void togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; updatebarpos(selmon);