diff -r 32c4d4563805 config.h --- a/config.h Thu Oct 25 19:24:28 2007 -0400 +++ b/config.h Fri Oct 26 05:08:55 2007 -0400 @@ -37,6 +37,9 @@ Layout layouts[] = { { "[]=", tile }, { "><>", floating }, }; + +/* Status text */ +char* statusbar[] = { cptstext, inputtext }; /* key definitions */ #define MODKEY Mod1Mask diff -r 32c4d4563805 dwm.c --- a/dwm.c Thu Oct 25 19:24:28 2007 -0400 +++ b/dwm.c Fri Oct 26 05:22:22 2007 -0400 @@ -167,6 +167,7 @@ void setclientstate(Client *c, long stat void setclientstate(Client *c, long state); void setlayout(const char *arg); void setmwfact(const char *arg); +void setstext(void); void setup(void); void spawn(const char *arg); void tag(const char *arg); @@ -192,7 +193,8 @@ void zoom(const char *arg); void zoom(const char *arg); /* variables */ -char stext[256]; +char inputtext[256]; +char stext[512]; double mwfact; int screen, sx, sy, sw, sh, wax, way, waw, wah; int (*xerrorxlib)(Display *, XErrorEvent *); @@ -551,6 +553,7 @@ drawbar(void) { dc.w = blw; drawtext(layouts[ltidx].symbol, dc.norm); x = dc.x + dc.w; + setstext(); dc.w = textw(stext); dc.x = sw - dc.w; if(dc.x < x) { @@ -1312,21 +1315,21 @@ run(void) { eprint("select failed\n"); } if(FD_ISSET(STDIN_FILENO, &rd)) { - switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) { + switch(r = read(STDIN_FILENO, inputtext, sizeof inputtext - 1)) { case -1: - strncpy(stext, strerror(errno), sizeof stext - 1); - stext[sizeof stext - 1] = '\0'; + strncpy(inputtext, strerror(errno), sizeof inputtext - 1); + inputtext[sizeof inputtext - 1] = '\0'; readin = False; break; case 0: - strncpy(stext, "EOF", 4); + strncpy(inputtext, "EOF", 4); readin = False; break; default: - for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; * - for(; p >= stext && *p != '\n'; --p); - if(p > stext) - strncpy(stext, p + 1, sizeof stext); + for(inputtext[r] = '\0', p = inputtext + strlen(inputtext) - 1; p >= inputtext + for(; p >= inputtext && *p != '\n'; --p); + if(p > inputtext) + strncpy(inputtext, p + 1, sizeof inputtext); } drawbar(); } @@ -1418,6 +1421,14 @@ setmwfact(const char *arg) { } void +setstext(void) { + int i; + stext[0] = '\0'; + for(i=0; icpt){ + snprintf(cptstext, 8, "{%d} ", n-cpt); + return cpt; + } + + cptstext[0] = '\0'; + drawbar(); + return n; +} + #ifdef NMASTER int nmaster = NMASTER; void @@ -87,7 +101,7 @@ ntile(void) { for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; - if (cpt!=-1 && n>cpt) n = cpt; + n = getclientspertag(n); /* window geoms */ mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster; @@ -136,7 +150,7 @@ dntile(void) { for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; - if (cpt!=-1 && n>cpt) n = cpt; + n = getclientspertag(n); /* dynamic nmaster */ if (n<5) inc = 0; @@ -266,7 +280,7 @@ tilecols(void) { else rows = nrows; - if (cpt!=-1 && n>cpt) n = cpt; + n = getclientspertag(n); /* window geoms */ mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;