unsigned int nmaster = NMASTER; void nmtile(void) { unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; Client *c; for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; /* window geoms */ mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); mw = (n > nmaster) ? waw * mwfact : waw; th = (n > nmaster) ? wah / (n - nmaster) : 0; tw = waw - mw; for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) { c->ismax = False; nx = wax; ny = way; if(i < nmaster) { ny += i * mh; nw = mw - 2 * c->border; nh = mh; if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */ nh = wah - mh * i; nh -= 2 * c->border; } else { /* tile window */ nx += mw; nw = tw - 2 * c->border; if(th > 2 * c->border) { ny += (i - nmaster) * th; nh = th; if(i + 1 == n) /* remainder */ nh = wah - th * (i - nmaster); nh -= 2 * c->border; } else /* fallback if th <= 2 * c->border */ nh = wah - 2 * c->border; } resize(c, nx, ny, nw, nh, RESIZEHINTS); } } void incnmaster(const char *arg) { int i; if(!isarrange(nmtile)) return; if(!arg) nmaster = NMASTER; else { i = atoi(arg); if((nmaster + i < 1) || (wah / (nmaster + i) <= 2 * BORDERPX)) return; nmaster += i; } arrange(); }