added client number printing right of layout symbol 87526be6
Anselm R Garbe · 2009-07-09 19:58 1 file(s) · +9 −5
dwm.c +9 −5
236 236
static void zoom(const Arg *arg);
237 237
238 238
/* variables */
239 -
static char stext[256];
239 +
static char stext[256], ntext[8];
240 240
static int screen;
241 241
static int sw, sh;           /* X display screen geometry x, y, width, height */
242 242
static int bh, blw = 0;      /* bar geometry */
641 641
void
642 642
drawbar(Monitor *m) {
643 643
	int x;
644 -
	unsigned int i, occ = 0, urg = 0;
644 +
	unsigned int i, n = 0, occ = 0, urg = 0;
645 645
	unsigned long *col;
646 646
	Client *c;
647 647
648 648
	for(c = m->clients; c; c = c->next) {
649 +
		if(ISVISIBLE(c))
650 +
			n++;
649 651
		occ |= c->tags;
650 652
		if(c->isurgent)
651 653
			urg |= c->tags;
662 664
	if(blw > 0) {
663 665
		dc.w = blw;
664 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
668 -
		x = dc.x;
669 +
	snprintf(ntext, sizeof ntext, "%u", n);
670 +
	dc.w = TEXTW(ntext);
671 +
	drawtext(ntext, dc.norm, False);
672 +
	x = (dc.x += dc.w);
669 673
	if(m == selmon) { /* status is only drawn on selected monitor */
670 674
		dc.w = TEXTW(stext);
671 675
		dc.x = m->ww - dc.w;