Sorry for noise, but this last version of ntile should fit better any geom.
Kind regards,
Nibble
int nmaster = NMASTER;
void
ntile(void) {
unsigned int i, n = counttiled(), lnx, lny, lnw, lnh, lmah, lmw, lmh, lth;
Client *c;
/* window geoms */
lmah = (n <= nmaster) ? moh : mh;
lmh = (n <= nmaster) ? lmah / (n > 0 ? n : 1) : lmah / nmaster;
lmw = (n <= nmaster) ? mow : mw;
lth = (n > nmaster) ? th / (n - nmaster) : 0;
if(n > nmaster && lth < bh)
lth = th;
lnx = mx;
lny = my;
for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
if(i < nmaster) { /* master */
lny = my + i * lmh;
lnw = lmw - 2 * c->bw;
lnh = lmh;
if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
lnh = lmah - lmh * i;
lnh -= 2 * c->bw;
}
else { /* tile window */
if(i == nmaster) {
lny = ty;
lnx = tx;
}
lnw = tw - 2 * c->bw;
if(i + 1 == n) /* remainder */
lnh = (ty + th) - lny;
else
lnh = lth;
lnh -= 2 * c->bw;
}
tileresize(c, lnx, lny, lnw, lnh);
if(n > nmaster && lth != wh)
lny += lnh + 2 * c->bw;
}
}
void
setnmaster(const char *arg) {
int i;
if(!arg)
nmaster = NMASTER;
else {
i = atoi(arg);
if((nmaster + i) < 1 || wh / (nmaster + i) <= 2 * BORDERPX)
return;
nmaster += i;
}
if(sel)
arrange();
}