summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dwm.c b/dwm.c
index 07d0d36..d71bb58 100644
--- a/dwm.c
+++ b/dwm.c
@@ -236,7 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
236static void zoom(const Arg *arg); 236static void zoom(const Arg *arg);
237 237
238/* variables */ 238/* variables */
239static char stext[256]; 239static char stext[256], ntext[8];
240static int screen; 240static int screen;
241static int sw, sh; /* X display screen geometry x, y, width, height */ 241static int sw, sh; /* X display screen geometry x, y, width, height */
242static int bh, blw = 0; /* bar geometry */ 242static int bh, blw = 0; /* bar geometry */
@@ -641,11 +641,13 @@ dirtomon(int dir) {
641void 641void
642drawbar(Monitor *m) { 642drawbar(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;
@@ -662,10 +664,12 @@ drawbar(Monitor *m) {
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;