dwm.c
changeset 1455 d71d573c3165
parent 1454 b55c7bd92fda
child 1457 96862665fd92
equal deleted inserted replaced
1454:b55c7bd92fda 1455:d71d573c3165
   234 static int xerrordummy(Display *dpy, XErrorEvent *ee);
   234 static int xerrordummy(Display *dpy, XErrorEvent *ee);
   235 static int xerrorstart(Display *dpy, XErrorEvent *ee);
   235 static int xerrorstart(Display *dpy, XErrorEvent *ee);
   236 static void zoom(const Arg *arg);
   236 static void zoom(const Arg *arg);
   237 
   237 
   238 /* variables */
   238 /* variables */
   239 static char stext[256];
   239 static char stext[256], ntext[8];
   240 static int screen;
   240 static int screen;
   241 static int sw, sh;           /* X display screen geometry x, y, width, height */
   241 static int sw, sh;           /* X display screen geometry x, y, width, height */
   242 static int bh, blw = 0;      /* bar geometry */
   242 static int bh, blw = 0;      /* bar geometry */
   243 static int (*xerrorxlib)(Display *, XErrorEvent *);
   243 static int (*xerrorxlib)(Display *, XErrorEvent *);
   244 static unsigned int numlockmask = 0;
   244 static unsigned int numlockmask = 0;
   639 }
   639 }
   640 
   640 
   641 void
   641 void
   642 drawbar(Monitor *m) {
   642 drawbar(Monitor *m) {
   643 	int x;
   643 	int x;
   644 	unsigned int i, occ = 0, urg = 0;
   644 	unsigned int i, n = 0, occ = 0, urg = 0;
   645 	unsigned long *col;
   645 	unsigned long *col;
   646 	Client *c;
   646 	Client *c;
   647 
   647 
   648 	for(c = m->clients; c; c = c->next) {
   648 	for(c = m->clients; c; c = c->next) {
       
   649 		if(ISVISIBLE(c))
       
   650 			n++;
   649 		occ |= c->tags;
   651 		occ |= c->tags;
   650 		if(c->isurgent)
   652 		if(c->isurgent)
   651 			urg |= c->tags;
   653 			urg |= c->tags;
   652 	}
   654 	}
   653 	dc.x = 0;
   655 	dc.x = 0;
   660 		dc.x += dc.w;
   662 		dc.x += dc.w;
   661 	}
   663 	}
   662 	if(blw > 0) {
   664 	if(blw > 0) {
   663 		dc.w = blw;
   665 		dc.w = blw;
   664 		drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
   666 		drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
   665 		x = dc.x + dc.w;
   667 		dc.x += dc.w;
   666 	}
   668 	}
   667 	else
   669 	snprintf(ntext, sizeof ntext, "%u", n);
   668 		x = dc.x;
   670 	dc.w = TEXTW(ntext);
       
   671 	drawtext(ntext, dc.norm, False);
       
   672 	x = (dc.x += dc.w);
   669 	if(m == selmon) { /* status is only drawn on selected monitor */
   673 	if(m == selmon) { /* status is only drawn on selected monitor */
   670 		dc.w = TEXTW(stext);
   674 		dc.w = TEXTW(stext);
   671 		dc.x = m->ww - dc.w;
   675 		dc.x = m->ww - dc.w;
   672 		if(dc.x < x) {
   676 		if(dc.x < x) {
   673 			dc.x = x;
   677 			dc.x = x;