Hi list,

with nmaster becoming mainstream (again), what was known as the
nmaster-ncol patch can also be simplified a lot. Attached file
provides a layout that arranges clients in columns in the master area.
Maybe someone finds it useful.

-- 
Thomas Dahms
void
ncol(Monitor *m) {
	unsigned int i, n, mw, tw, th;
	Client *c;

	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
	if(n == 0)
		return;

	mw = (n > m->nmaster) ? m->ww * m->mfact / m->nmaster : m->ww / n;
	th = (n > m->nmaster) ? m->wh / (n - m->nmaster) : 0;
	tw = (n > m->nmaster) ? m->ww - mw * m->nmaster : 0;

	for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
		if(i < m->nmaster)
			resize(c, m->wx + (i*mw), m->wy, mw - (2*c->bw), m->wh - (2*c->bw), False);
		else
			resize(c, m->wx + mw * m->nmaster, m->wy + ((i - m->nmaster)*th), tw - (2*c->bw), th - (2*c->bw), False);
}

Reply via email to