Hi,
I've just updated my taskbar patch to the current hg tip and fixed
some bugs :)
Kind regards,
Nibble
diff -r 00da7bf0bba7 dwm.c
--- a/dwm.c Sat Dec 06 09:33:58 2008 +0000
+++ b/dwm.c Sat Dec 06 16:40:41 2008 +0100
@@ -487,8 +487,8 @@ die(const char *errstr, ...) {
void
drawbar(void) {
- int x;
- unsigned int i, occ = 0, urg = 0;
+ int x, stx;
+ unsigned int i, occ = 0, urg = 0, vc = 0;
unsigned long *col;
Client *c;
@@ -496,6 +496,8 @@ drawbar(void) {
occ |= c->tags;
if(c->isurgent)
urg |= c->tags;
+ if(ISVISIBLE(c))
+ vc++;
}
dc.x = 0;
@@ -520,12 +522,18 @@ drawbar(void) {
dc.w = ww - x;
}
drawtext(stext, dc.norm, False);
- if((dc.w = dc.x - x) > bh) {
+ if((dc.w = vc > 0 ? (dc.x - x) / vc : dc.x - x) > bh) {
+ stx = dc.x;
dc.x = x;
- if(sel) {
- drawtext(sel->name, dc.sel, False);
- drawsquare(sel->isfixed, sel->isfloating, False, dc.sel);
- }
+ if(sel)
+ for(c = clients, i = 1; c; c = c->next) {
+ if(ISVISIBLE(c)) {
+ drawtext(c->name, (c == sel ? dc.sel : dc.norm), False);
+ drawsquare(c->isfixed, c->isfloating, False, (c == sel ? dc.sel : dc.norm));
+ dc.x += dc.w;
+ dc.w = ++i < vc ? dc.w : stx - dc.x;
+ }
+ }
else
drawtext(NULL, dc.norm, False);
}