> Hi,

Hi, 

> How about changing the "invert" parameter in "drawtext" and
> "drawsquare" to c->isurgent ?

Now that the urgent hint flag is removed when the client is focused
it makes sense. I like it, thanks :) I attach the new patch.

> Regards,

Regards,
Nibble
diff -r 79bf47074a49 dwm.c
--- a/dwm.c	Sat Dec 06 16:20:14 2008 +0000
+++ b/dwm.c	Sat Dec 06 20:58:44 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), c->isurgent);
+					drawsquare(c->isfixed, c->isfloating, c->isurgent, (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);
 	}

Reply via email to