diff --git a/dwm.c b/dwm.c --- a/dwm.c +++ b/dwm.c42a43,45 > #define INFO_FMT_WRITE "%ld %u\n", c->win, c->tags > #define INFO_FMT_READ "%ld %u\n", &c_win, &c_tags > 196a201 > static void loadinfo(void); 210a218 > static void saveinfo(void); 1114a1134,1162 > loadinfo(void) { > Client *c; > Monitor *m; > FILE *sf; > long int c_win; > unsigned int c_tags; > long int wins[500][2]; > int i, j; > if ((sf = fopen(saveinfofile, "r")) == NULL) > return; > i = 0; > while (fscanf(sf, INFO_FMT_READ) != EOF) { > wins[i][0] = c_win; > wins[i][1] = (long)c_tags; > i++; > } > fclose(sf); > for(m = mons; m; m = m->next) { > for(c = m->clients; c; c = c->next) { > for(j = 0; c->win != wins[j][0] && j < i; j++); > if (wins[j][0] != c->win) > continue; > c->tags = (unsigned int)wins[j][1]; > } > } > arrange(selmon); > } > > void 1135a1184 > free(t); 1462a1562,1574 > saveinfo(void) { > Client *c; > Monitor *m; > FILE *sf; > if ((sf = fopen(saveinfofile, "w")) == NULL) > return; > for(m = mons; m; m = m->next) > for(c = m->clients; c; c = c->next) > fprintf(sf, INFO_FMT_WRITE); > fclose(sf); > } > > void 2079a2192 > loadinfo(); 2080a2194 > saveinfo();