diff -r 767e76426fda config.def.h --- a/config.def.h Sat Nov 10 20:21:22 2007 +0100 +++ b/config.def.h Sun Nov 11 22:42:15 2007 +0100 @@ -24,6 +24,7 @@ Rule rules[] = { /* layout(s) */ #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ +#define NMASTER 1 /* clients in master area */ #define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define SNAP 32 /* snap pixel */ Layout layouts[] = { @@ -46,6 +47,8 @@ Key keys[] = { { MODKEY, XK_k, focusprev, NULL }, { MODKEY, XK_h, setmwfact, "-0.05" }, { MODKEY, XK_l, setmwfact, "+0.05" }, + { MODKEY|ShiftMask, XK_h, setnmaster, "-1" }, \ + { MODKEY|ShiftMask, XK_l, setnmaster, "+1" }, \ { MODKEY, XK_m, togglemax, NULL }, { MODKEY, XK_Return, zoom, NULL }, { MODKEY, XK_Tab, viewprevtag, NULL }, diff -r 767e76426fda dwm.1 --- a/dwm.1 Sat Nov 10 20:21:22 2007 +0100 +++ b/dwm.1 Sun Nov 11 22:42:15 2007 +0100 @@ -80,6 +80,12 @@ Increases the master area width about 5% .B Mod1\-m Toggles maximization of current window. .TP +.B Mod1\-Shift\-h +Decrease the number of windows in the master area (tiled layout only). +.TP +.B Mod1\-Shift\-l +Increase the number of windows in the master area (tiled layout only). +.TP .B Mod1\-Shift\-[1..n] Apply .RB nth diff -r 767e76426fda dwm.c --- a/dwm.c Sat Nov 10 20:21:22 2007 +0100 +++ b/dwm.c Sun Nov 11 22:42:16 2007 +0100 @@ -168,6 +168,7 @@ void setclientstate(Client *c, long stat void setclientstate(Client *c, long state); void setlayout(const char *arg); void setmwfact(const char *arg); +void setnmaster(const char *arg); void setup(void); void spawn(const char *arg); void tag(const char *arg); @@ -195,6 +196,7 @@ void zoom(const char *arg); /* variables */ char stext[256]; double mwfact; +unsigned int nmaster; int screen, sx, sy, sw, sh, wax, way, waw, wah; int (*xerrorxlib)(Display *, XErrorEvent *); unsigned int bh, bpos; @@ -1424,6 +1426,26 @@ setmwfact(const char *arg) { } void +setnmaster(const char *arg) { + int i; + + if(layout->arrange != 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 + drawbar(); +} + +void setup(void) { int d; unsigned int i, j, mask; @@ -1487,6 +1509,7 @@ setup(void) { /* init layouts */ mwfact = MWFACT; + nmaster = NMASTER; layout = &layouts[0]; for(blw = i = 0; i < LENGTH(layouts); i++) { j = textw(layouts[i].symbol); @@ -1570,7 +1593,7 @@ textw(const char *text) { 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, *mc; domwfact = dozoom = True; @@ -1578,9 +1601,10 @@ tile(void) { 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; @@ -1588,12 +1612,17 @@ tile(void) { nw = 0; /* gcc stupidity requires this */ for(i = 0, c = mc = 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 += mc->w + 2 * mc->border; nw = waw - nx - 2 * c->border; @@ -1607,7 +1636,7 @@ tile(void) { if((RESIZEHINTS) && ((c->h < bh) || (c->h > nh) || (c->w < bh) || (c->w > nw))) /* client doesn't accept size constraints */ resize(c, nx, ny, nw, nh, False); - if(n > 1 && th != wah) + if(n > nmaster && th != wah) ny = c->y + c->h + 2 * c->border; } }