--- .pvc//leaf/fa0281b4/0-pancake@pl2 2007-10-16 22:53:03.000000000 +0200 +++ config.h 2007-10-16 23:17:45.000000000 +0200 @@ -42,6 +42,8 @@ { MODKEY|ShiftMask, XK_Return, spawn, \ "exec xterm -bg '"NORMBGCOLOR"' -fg '"NORMFGCOLOR"' -cr '"NORMFGCOLOR"' +sb -fn '"FONT"'" }, \ { MODKEY, XK_space, setlayout, NULL }, \ + { MODKEY|ShiftMask, XK_k, incnmaster, "-1" }, \ + { MODKEY|ShiftMask, XK_j, incnmaster, "1" }, \ { MODKEY, XK_b, togglebar, NULL }, \ { MODKEY, XK_j, focusnext, NULL }, \ { MODKEY, XK_k, focusprev, NULL }, \ --- .pvc//leaf/9437c28e/0-pancake@pl2 2007-10-16 22:53:03.000000000 +0200 +++ dwm.c 2007-10-16 22:53:35.000000000 +0200 @@ -231,6 +231,8 @@ /* configuration, allows nested code to access above variables */ #include "config.h" +unsigned int nmaster = NMASTER; + /* functions*/ void applyrules(Client *c) { @@ -287,6 +289,26 @@ } void +incnmaster(const char *arg) { + int i; + + if(!isarrange(tile)) + return; + if(!arg) + nmaster = NMASTER; + else { + i = atoi(arg); + if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * BORDERPX) + return; + nmaster += i; + } + if(sel) + arrange(); + //else + // drawstatus(); +} + +void attachstack(Client *c) { c->snext = stack; stack = c; @@ -1567,28 +1589,33 @@ void tile(void) { - unsigned int i, n, nx, ny, nw, nh, mw, th; + unsigned int i, n, nx, ny, nw, nh, mw, mh, th; Client *c; for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; /* window geoms */ - mw = (n == 1) ? waw : mwfact * waw; - th = (n > 1) ? wah / (n - 1) : 0; - if(n > 1 && th < bh) + mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster; + mw = (n <= nmaster) ? waw : mwfact * waw; + th = (n > nmaster) ? wah / (n - nmaster) : 0; + if(n > nmaster && th < bh) th = wah; nx = wax; ny = way; for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) { c->ismax = False; - if(i == 0) { /* master */ + if(i < nmaster) { /* master */ + ny = way + i * mh; nw = mw - 2 * c->border; - nh = wah - 2 * c->border; + nh = mh; + if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */ + nh = wah - mh * i; + nh -= 2 * c->border; } else { /* tile window */ - if(i == 1) { + if(i == nmaster) { ny = way; nx += mw; } @@ -1599,7 +1626,7 @@ nh = th - 2 * c->border; } resize(c, nx, ny, nw, nh, RESIZEHINTS); - if(n > 1 && th != wah) + if(n > nmaster && th != wah) ny += nh + 2 * c->border; } }