dvtm

Fork of dvtm, a minimal terminal multiplexer
git clone git://git.laack.co/dvtm.git
Log | Files | Refs | README | LICENSE

vstack.c (684B)


      1 /* A vertical stack layout, all windows have the full screen width. */
      2 static void vstack(void)
      3 {
      4 	unsigned int i, n, ny, nh, m, mh, th;
      5 	Client *c;
      6 
      7 	for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
      8 		if (!c->minimized)
      9 			n++;
     10 
     11 	m  = MAX(1, MIN(n, screen.nmaster));
     12 	mh = (n == m ? wah : screen.mfact * wah);
     13 	th = n == m ? 0 : (wah - mh) / (n - m);
     14 	ny = way;
     15 
     16 	for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
     17 		if (c->minimized)
     18 			continue;
     19 		if (i < m) /* master */
     20 			nh = (i < m - 1) ? mh / m : (way + mh) - ny;
     21 		else /* tile window */
     22 			nh = (i < n - 1) ? th : (way + wah) - ny;
     23 		resize(c, wax, ny, waw, nh);
     24 		ny += nh;
     25 		i++;
     26 	}
     27 }