about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-03-17 16:26:06 +0000
committerAnselm R Garbe <garbeam@gmail.com>2008-03-17 16:26:06 +0000
commitfe6b0c0fc17d70e1c0f002e397bd2d3ac152ede0 (patch)
treebc4ee93735e52004e2922a058aee4c310ac32572 /dwm.c
parentaa2395b6a81475b44dd74618fb7f0b40305e10bb (diff)
downloaddwm-fe6b0c0fc17d70e1c0f002e397bd2d3ac152ede0.tar.gz
geoms are now drawed in the status bar
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index f83e800..6b46911 100644
--- a/dwm.c
+++ b/dwm.c
@@ -210,7 +210,7 @@ void zoom(const char *arg);
 char stext[256], buf[256];
 int screen, sx, sy, sw, sh;
 int (*xerrorxlib)(Display *, XErrorEvent *);
-int bx, by, bw, bh, blw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
+int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
 unsigned int numlockmask = 0;
 void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
@@ -322,10 +322,10 @@ buttonpress(XEvent *e) {
 	XButtonPressedEvent *ev = &e->xbutton;
 
 	if(ev->window == barwin) {
-		x = 0;
+		x = bgw;
 		for(i = 0; i < LENGTH(tags); i++) {
 			x += textw(tags[i]);
-			if(ev->x < x) {
+			if(ev->x > bgw && ev->x < x) {
 				if(ev->button == Button1) {
 					if(ev->state & MODKEY)
 						tag(tags[i]);
@@ -514,6 +514,9 @@ drawbar(void) {
 	Client *c;
 
 	dc.x = 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]);
@@ -854,7 +857,7 @@ unsigned int
 idxoftag(const char *t) {
 	unsigned int i;
 
-	for(i = 0; (i < LENGTH(tags)) && (tags[i] != t); i++);
+	for(i = 0; (i < LENGTH(tags)) && strcmp(tags[i], t); i++);
 	return (i < LENGTH(tags)) ? i : 0;
 }
 
@@ -1501,6 +1504,11 @@ setup(void) {
 		if(i > blw)
 			blw = i;
 	}
+	for(bgw = i = 0; i < LENGTH(geoms); i++) {
+		i = textw(geoms[i].symbol);
+		if(i > bgw)
+			bgw = i;
+	}
 
 	wa.override_redirect = 1;
 	wa.background_pixmap = ParentRelative;