geom indicator and layout indicator is only displayed if there are several geoms/layouts
authorAnselm R Garbe <garbeam@gmail.com>
Mon, 24 Mar 2008 13:33:32 +0000
changeset 1158 7c40610de8df
parent 1157 5fb97aa00e2f
child 1159 34c88d74dff0
geom indicator and layout indicator is only displayed if there are several geoms/layouts
config.def.h
dwm.c
--- a/config.def.h	Sat Mar 22 16:53:37 2008 +0000
+++ b/config.def.h	Mon Mar 24 13:33:32 2008 +0000
@@ -15,10 +15,7 @@
 
 Rule rules[] = {
 	/* class	instance	title		tags ref	isfloating */
-	{ NULL,		NULL,		"Firefox",	tags[8],	False },
-	{ NULL,		NULL,		"Gimp",		NULL,		True },
-	{ NULL,		NULL,		"MPlayer",	NULL,		True },
-	{ NULL,		NULL,		"Acroread",	NULL,		True },
+	{ "Gimp",	NULL,		NULL,		NULL,		True },
 };
 
 /* geometries, s{x,y,w,h} and bh are already initualized here */
--- a/dwm.c	Sat Mar 22 16:53:37 2008 +0000
+++ b/dwm.c	Mon Mar 24 13:33:32 2008 +0000
@@ -517,9 +517,11 @@
 	Client *c;
 
 	dc.x = 0;
-	dc.w = bgw;
-	drawtext(geom->symbol, dc.norm, False);
-	dc.x += bgw;
+	if(bgw > 0) {
+		dc.w = bgw;
+		drawtext(geom->symbol, dc.norm, False);
+		dc.x += bgw;
+	}
 	for(c = stack; c && !isvisible(c); c = c->snext);
 	for(i = 0; i < LENGTH(tags); i++) {
 		dc.w = textw(tags[i]);
@@ -533,9 +535,13 @@
 		}
 		dc.x += dc.w;
 	}
-	dc.w = blw;
-	drawtext(lt->symbol, dc.norm, False);
-	x = dc.x + dc.w;
+	if(blw > 0) {
+		dc.w = blw;
+		drawtext(lt->symbol, dc.norm, False);
+		x = dc.x + dc.w;
+	}
+	else
+		x = dc.x;
 	dc.w = textw(stext);
 	dc.x = bw - dc.w;
 	if(dc.x < x) {
@@ -1502,12 +1508,12 @@
 	lt = &layouts[0];
 
 	/* init bar */
-	for(blw = i = 0; i < LENGTH(layouts); i++) {
+	for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
 		w = textw(layouts[i].symbol);
 		if(w > blw)
 			blw = w;
 	}
-	for(bgw = i = 0; i < LENGTH(geoms); i++) {
+	for(bgw = i = 0; LENGTH(geoms) > 1 && i < LENGTH(geoms); i++) {
 		w = textw(geoms[i].symbol);
 		if(w > bgw)
 			bgw = w;