On Thu, Aug 23, 2007 at 12:23:52PM -0400, cr wrote:
> >  - i really miss the nmaster feature (i used most of times to have a 
> > grid-like
> >    layout and be able to use better the vertical space on the left area
> > 
> >  - I plan to port the clients-per-tag patch soon
> >  - for the rest, it looks pretty fine to me as usually :)
> 
> and nmaster patch? :)

Something like attached? 

Regards,
-- 
Jeroen Schot

[EMAIL PROTECTED] (mail & jabber)
http://schot.a-eskwadraat.nl
diff -r 1c30ac0aee7f config.default.h
--- a/config.default.h  Thu Aug 23 18:15:13 2007 +0200
+++ b/config.default.h  Thu Aug 23 23:13:24 2007 +0200
@@ -33,6 +33,7 @@ static Layout layouts[] = { \
        { "><>",                floating }, \
 };
 #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 */
@@ -48,6 +49,8 @@ Key keys[] = { \
        { MODKEY,                       XK_k,           focusprev,      NULL }, 
\
        { MODKEY,                       XK_h,           setmwfact,      "-0.05" 
}, \
        { MODKEY,                       XK_l,           setmwfact,      "+0.05" 
}, \
+       { MODKEY|ShiftMask,             XK_h,           incnmaster,     "-1" }, 
\
+       { MODKEY|ShiftMask,             XK_l,           incnmaster,     "1" }, \
        { MODKEY,                       XK_m,           togglemax,      NULL }, 
\
        { MODKEY,                       XK_Return,      zoom,           NULL }, 
\
        { MODKEY|ShiftMask,             XK_space,       togglefloating, NULL }, 
\
diff -r 1c30ac0aee7f tile.c
--- a/tile.c    Thu Aug 23 18:15:13 2007 +0200
+++ b/tile.c    Thu Aug 23 23:20:25 2007 +0200
@@ -5,8 +5,29 @@
 /* static */
 
 static double mwfact = MWFACT;
+static unsigned int nmaster = NMASTER;
 
 /* extern */
+
+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
 setmwfact(const char *arg) {
@@ -32,28 +53,33 @@ setmwfact(const char *arg) {
 
 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 - 1) : 0;
+       if(n > nmaster && th < bh)
                th = wah;
 
        nx = wax;
        ny = way;
        for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
                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;
                        }
diff -r 1c30ac0aee7f tile.h
--- a/tile.h    Thu Aug 23 18:15:13 2007 +0200
+++ b/tile.h    Thu Aug 23 22:50:14 2007 +0200
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 /* tile.c */
+void incnmaster(const char *arg);      /* increments nmaster value */
 void setmwfact(const char *arg);       /* sets master width factor */
 void tile(void);                       /* arranges all windows tiled */
 void zoom(const char *arg);            /* zooms the focused client to master 
area, arg is ignored */

Reply via email to