tabbed

my build of tabbed
git clone git://git.ckyln.com/~cem/tabbed.git
Log | Files | Refs | README | LICENSE

commit 5fbda03ff703e9a4a82fc4e69ab6dab8c0618e21
parent 0f67f586b1a95c0f006f50738bf8b418968076c8
Author: Enno Boland (tox) <tox@s01.de>
Date:   Tue,  8 Sep 2009 12:17:59 +0200

nicer tabbar.
Diffstat:
Mtabbed.c | 25++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/tabbed.c b/tabbed.c @@ -190,16 +190,32 @@ die(const char *errstr, ...) { void drawbar() { unsigned long *col; - unsigned int n; + int n, width; Client *c, *fc; + width = ww; + for(n = 0, fc = c = getfirsttab(); c; c = c->next, n++); + if(n * 200 > width) { + dc.w = TEXTW(after); + dc.x = width - dc.w; + drawtext(after, dc.norm); + width -= dc.w; + } dc.x = 0; - drawtext("", dc.norm); - for(fc = c = getfirsttab(); c; c = c->next, n++); - for(c = fc; c && dc.x < ww; c = c->next) { + if(fc != clients) { + dc.w = TEXTW(before); + drawtext(before, dc.norm); + dc.x += dc.w; + width -= dc.w; + } + for(c = fc; c && dc.x < width; c = c->next) { dc.w = tabwidth; if(c == sel) { col = dc.sel; + if(n * tabwidth > width) + dc.w += width % tabwidth; + else + dc.w = width - (n - 1) * 200; } else { col = dc.norm; @@ -292,7 +308,6 @@ getfirsttab() { unsigned int n, seli; Client *c, *fc; - return clients; c = fc = clients; for(n = 0; c; c = c->next, n++); if(n * tabwidth > ww) {