Preserve marks between restarts.

This commit is contained in:
Helgi Kristvin Sigurbjarnarson 2011-08-07 16:42:23 +00:00 committed by Michael Stapelberg
parent 96ed68de16
commit 3cc22dcbe4
2 changed files with 9 additions and 0 deletions

View File

@ -200,6 +200,11 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("urgent");
y(bool, con->urgent);
if (con->mark != NULL) {
ystr("mark");
ystr(con->mark);
}
ystr("focused");
y(bool, (con == focused));

View File

@ -146,6 +146,10 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
json_node->layout = L_OUTPUT;
else LOG("Unhandled \"layout\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "mark") == 0) {
char *buf = NULL;
asprintf(&buf, "%.*s", (int)len, val);
json_node->mark = buf;
}
}
return 1;