--- bstack.c Wed Dec 31 19:00:00 1969 +++ bstack.c Mon May 26 12:25:05 2008 @@ -0,0 +1,46 @@ +void +bstack(void) { + int x, y, h, w, mh; + uint i, n; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + + /* master */ + c = nexttiled(clients); + mh = mfact * wh; + resize(c, wx, wy, ww - 2 * c->bw, ((n == 1) ? wh : mh) - 2 * c->bw, resizehints); + + if(--n == 0) + return; + + /* tile stack */ + x = wx; + y = (wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : wh - mh; + w = ww / n; + h = (wy + mh > c->y + c->h) ? wy + wh - y : wh - mh; + if(h < bh) + h = wh; + + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, /* remainder */ ((i + 1 == n) ? (wx + ww) - x + : w) - 2 * c->bw, h - 2 * c->bw, resizehints); + if(w != ww) + x = c->x + c->w + 2 * c->bw; + } +} + +void +bsetmfact(const void *arg) { + double d = *((double*) arg); + + if(!d || lt->arrange != bstack) + return; + d = d < 1.0 ? d + mfact : d - 1.0; + if(d < 0.1 || d > 0.9) + return; + mfact = d; + arrange(); +} --- config.def.h Mon May 26 12:26:40 2008 +++ config.def.h Mon May 26 12:26:00 2008 @@ -26,10 +26,13 @@ Rule rules[] = { double mfact = 0.55; Bool resizehints = True; /* False means respect size hints in tiled resizals */ +#include "bstack.c" + Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ + { "TTT", bstack }, }; /* key definitions */ @@ -49,6 +52,8 @@ Key keys[] = { { MODKEY, XK_k, focusprev, NULL }, { MODKEY, XK_h, setmfact, (double[]){-0.05} }, { MODKEY, XK_l, setmfact, (double[]){+0.05} }, + { MODKEY, XK_h, bsetmfact, (double[]){-0.05} }, + { MODKEY, XK_l, bsetmfact, (double[]){+0.05} }, { MODKEY, XK_m, togglemax, NULL }, { MODKEY, XK_Return, zoom, NULL }, { MODKEY, XK_Tab, viewprevtag, NULL },