From 3cc22dcbe405c4b5c5d5f2cb04a8b7dc74961990 Mon Sep 17 00:00:00 2001 From: Helgi Kristvin Sigurbjarnarson Date: Sun, 7 Aug 2011 16:42:23 +0000 Subject: [PATCH] Preserve marks between restarts. --- src/ipc.c | 5 +++++ src/load_layout.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/ipc.c b/src/ipc.c index 9ad89cbb..a83e5fe4 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -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)); diff --git a/src/load_layout.c b/src/load_layout.c index b61a0e5c..37322c4e 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -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; -- 2.39.5