dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit b506fd81b09734a98874ec385bc995bf2729fbac
parent e9126983d0d0b1a008cf7919d2113ccf30400054
Author: Claudio M. Alessi <smoppy@gmail.com>
Date:   Sat, 18 Oct 2008 18:19:56 +0200

Top stack layout

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
tstack.c | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+), 0 deletions(-)

diff --git a/tstack.c b/tstack.c @@ -0,0 +1,53 @@ +void +tstack(void) { + unsigned int i, m, n, nx, ny, nw, nh, mh, tw; + Client *c; + + for(n = 0, m = 0, c = clients; c; c = c->next, n++) + if(c->minimized) + m++; + + /* relative height */ + mh = (wah - m) * (n == 1 || n - 1 == m ? 1 : mwfact); + + /* true if there are at least 2 non minimized clients */ + if(n - 1 > m) + tw = waw / (n - m - 1); + + nx = wax, nw = waw; + for(i = 0, c = clients; c; c = c->next, i++){ + if(i == 0){ /* master */ + ny = wah - mh; + nh = mh; + } else { /* tile window */ + if(i == 1){ + nx = wax; + ny = way + m; + nh = wah - mh - ny; + } + if(i == n - m - 1){ /* last not minimized client */ + nw = (wax + waw) - nx; + } else if(i == n - m){ /* first minimized client */ + nx = wax; + ny--; + nh = 1; + nw = waw; + } else if(c->minimized) { /* minimized window */ + ny--; + nh = 1; + nw = waw; + } else /* normal non minimized tile window */ + nw = tw; + if(i > 1 && !c->minimized){ + mvvline(ny, nx, ACS_VLINE, nh); + mvaddch(ny, nx, ACS_TTEE); + nx++, nw--; + } + } + + resize(c,nx,ny,nw,nh); + + if(n > 1 && i < n - m - 1) + nx += nw; + } +}