--- dwm~/config.h 2007-09-21 18:16:34.000000000 +0200 +++ dwm/config.h 2007-09-21 19:03:35.000000000 +0200 @@ -29,6 +29,7 @@ Layout layouts[] = { }; #define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ +#define NMASTER 1 /* clients in master area */ #define SNAP 32 /* snap pixel */ /* key definitions */ @@ -47,6 +48,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|ShiftMask, XK_space, togglefloating, NULL }, \ --- dwm~/dwm.1 2007-09-21 18:16:34.000000000 +0200 +++ dwm/dwm.1 2007-09-21 18:57:03.000000000 +0200 @@ -77,6 +77,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 --- dwm~/dwm.c 2007-09-21 18:16:34.000000000 +0200 +++ dwm/dwm.c 2007-09-21 19:10:07.000000000 +0200 @@ -166,6 +166,7 @@ void scan(void); 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); @@ -192,6 +193,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, ntags; @@ -1417,6 +1419,26 @@ setmwfact(const char *arg) { } void +setnmaster(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 + drawbar(); +} + +void setup(void) { unsigned int i, j, mask; Window w; @@ -1481,6 +1503,7 @@ setup(void) { /* init layouts */ mwfact = MWFACT; + nmaster = NMASTER; nlayouts = sizeof layouts / sizeof layouts[0]; for(blw = i = 0; i < nlayouts; i++) { j = textw(layouts[i].symbol); @@ -1566,28 +1589,33 @@ 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; 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; } @@ -1598,7 +1626,7 @@ tile(void) { 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; } }