diff -r 32c4d4563805 config.h --- a/config.h Thu Oct 25 19:24:28 2007 -0400 +++ b/config.h Tue Oct 30 21:47:32 2007 -0400 @@ -38,6 +38,9 @@ Layout layouts[] = { { "><>", floating }, }; +/* Status text */ +char* statusbar[] = { cptstext, inputtext }; + /* key definitions */ #define MODKEY Mod1Mask #define KEYS \ diff -r 32c4d4563805 dwm.c --- a/dwm.c Thu Oct 25 19:24:28 2007 -0400 +++ b/dwm.c Tue Oct 30 22:31:24 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) { @@ -1292,8 +1295,7 @@ restack(void) { void run(void) { - char *p; - int r, xfd; + int r, pos, xfd; fd_set rd; XEvent ev; @@ -1312,21 +1314,19 @@ run(void) { eprint("select failed\n"); } if(FD_ISSET(STDIN_FILENO, &rd)) { - switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) { + pos = inputtext[strlen(inputtext)-1] != '\n' ? strlen(inputtext) : 0; + switch(r = read(STDIN_FILENO, &(inputtext[pos]), sizeof inputtext - 1 - pos)) { 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'; *p-- = '\0'); - for(; p >= stext && *p != '\n'; --p); - if(p > stext) - strncpy(stext, p + 1, sizeof stext); + inputtext[pos+r] = '\0' ; } drawbar(); } @@ -1418,6 +1418,17 @@ 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;