JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
The screen number can be fetched from the region.
authorTiago Cunha <tcunha@gmx.com>
Sun, 13 May 2012 18:00:16 +0000 (19:00 +0100)
committerTiago Cunha <tcunha@gmx.com>
Tue, 5 Jun 2012 21:32:01 +0000 (22:32 +0100)
spectrwm.c

index 7a0ccf2..082d04e 100644 (file)
@@ -1480,8 +1480,7 @@ bar_fmt(char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz)
 
 /* replaces the bar format character sequences (like in tmux(1)) */
 void
-bar_replace(char *fmt, char *fmtrep, int nscreen, struct swm_region *r,
-    size_t sz)
+bar_replace(char *fmt, char *fmtrep, struct swm_region *r, size_t sz)
 {
        char                    *ptr;
        char                    tmp[SWM_BAR_MAX];
@@ -1515,7 +1514,7 @@ bar_replace(char *fmt, char *fmtrep, int nscreen, struct swm_region *r,
                        snprintf(tmp, sizeof tmp, "%d", r->ws->idx + 1);
                        break;
                case 'N':
-                       snprintf(tmp, sizeof tmp, "%d", nscreen + 1);
+                       snprintf(tmp, sizeof tmp, "%d", r->s->idx + 1);
                        break;
                case 'S':
                        snprintf(tmp, sizeof tmp, "%s", r->ws->stacker);
@@ -1595,7 +1594,7 @@ bar_fmt_print(void)
        for (i = 0; i < ScreenCount(display); i++) {
                TAILQ_FOREACH(r, &screens[i].rl, entry) {
                        bar_fmt(fmtexp, fmtnew, r, sizeof fmtnew);
-                       bar_replace(fmtnew, fmtrep, i, r, sizeof fmtrep);
+                       bar_replace(fmtnew, fmtrep, r, sizeof fmtrep);
                        bar_print(r, fmtrep);
                }
        }