--- layout.c Wed May 30 06:20:42 2007 +++ layout.c Sat Jun 16 10:16:28 2007 @@ -28,7 +28,7 @@ unban(Client *c) { } static void -tile(void) { +_tile(const Bool right) { unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; Client *c; @@ -49,6 +49,8 @@ tile(void) { nx = wax; ny = way; if(i < nmaster) { + if(!right) + nx += tw; ny += i * mh; nw = mw - 2 * c->border; nh = mh; @@ -57,7 +59,8 @@ tile(void) { nh -= 2 * c->border; } else { /* tile window */ - nx += mw; + if(right) + nx += mw; nw = tw - 2 * c->border; if(th > 2 * c->border) { ny += (i - nmaster) * th; @@ -78,6 +81,83 @@ tile(void) { restack(); } +static void +_bstack(const Bool portrait) { + unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + /* window geoms */ + mh = (n > nmaster) ? ((wah * masterw) / 1000) / nmaster : wah / (n > 0 ? n : 1); + mw = waw; + th = (n > nmaster) ? ((wah * (1000 - masterw)) / 1000) / (portrait ? 1 : n - nmaster) : 0; + tw = (n > nmaster) ? waw / (portrait ? n - nmaster : 1) : 0; + + for(i = 0, c = clients; c; c = c->next) + if(isvisible(c)) { + if(c->isbanned) + XMoveWindow(dpy, c->win, c->x, c->y); + c->isbanned = False; + if(c->isfloating) + continue; + c->ismax = False; + nx = wax; + ny = way; + if(i < nmaster) { + ny += i * mh; + nw = mw - 2 * c->border; + nh = mh - 2 * c->border; + } + else if(portrait) { /* portrait bstack tiles */ + nx += (i - nmaster) * tw; + ny += mh * nmaster; + nw = tw - 2 * c->border; + nh = th - 2 * c->border + 1; + } else { /* landscape bstack tiles */ + ny += mh * nmaster; + nw = tw - 2 * c->border; + if(th > 2 * c->border) { + ny += (i - nmaster) * th; + nh = th - 2 * c->border; + if (i == n - 1) + nh += (n > nmaster) ? wah - mh - th * (n - nmaster) : 0; + } + else /* fallback if th <= 2 * c->border */ + nh = wah - 2 * c->border; + } + resize(c, nx, ny, nw, nh, False); + i++; + } + else { + c->isbanned = True; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + } + if(!sel || !isvisible(sel)) + focus(c); + restack(); +} + +static void +tile(void) { + _tile(True); +} + +static void +tileleft(void) { + _tile(False); +} + +static void +bstackportrait(void) { + _bstack(True); +} + +static void +bstacklandscape(void) { + _bstack(False); +} + LAYOUTS /* extern */ @@ -126,7 +206,7 @@ focusclient(const char *arg) { void incmasterw(const char *arg) { int i; - if(lt->arrange != tile) + if(lt->arrange == floating) return; if(!arg) masterw = MASTERWIDTH; @@ -148,7 +228,7 @@ incnmaster(const char *arg) { nmaster = NMASTER; else { i = atoi(arg); - if((lt->arrange != tile) || (nmaster + i < 1) + if((lt->arrange == floating) || (nmaster + i < 1) || (wah / (nmaster + i) <= 2 * BORDERPX)) return; nmaster += i; --- config.default.h Wed May 30 06:20:42 2007 +++ config.default.h Fri Jun 15 23:03:30 2007 @@ -29,6 +29,9 @@ static Rule rule[] = { \ static Layout layout[] = { \ /* symbol function */ \ { "[]=", tile }, /* first entry is default */ \ + { "=[]", tileleft }, \ + { "TTT", bstackportrait }, \ + { "===", bstacklandscape }, \ { "><>", floating }, \ }; #define MASTERWIDTH 600 /* master width per thousand */