Preserve back_and_forth during restart
Add new key "previous_workspace_name" to the json dump of the root container.
This commit is contained in:
@ -651,6 +651,11 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
|
||||
y(integer, con->depth);
|
||||
}
|
||||
|
||||
if (inplace_restart && con->type == CT_ROOT && previous_workspace_name) {
|
||||
ystr("previous_workspace_name");
|
||||
ystr(previous_workspace_name);
|
||||
}
|
||||
|
||||
y(map_close);
|
||||
}
|
||||
|
||||
|
@ -420,6 +420,9 @@ static int json_string(void *ctx, const unsigned char *val, size_t len) {
|
||||
else if (strcasecmp(buf, "changed") == 0)
|
||||
json_node->scratchpad_state = SCRATCHPAD_CHANGED;
|
||||
free(buf);
|
||||
} else if (strcasecmp(last_key, "previous_workspace_name") == 0) {
|
||||
FREE(previous_workspace_name);
|
||||
previous_workspace_name = sstrndup((const char *)val, len);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -11,9 +11,12 @@
|
||||
#include "all.h"
|
||||
#include "yajl_utils.h"
|
||||
|
||||
/* Stores a copy of the name of the last used workspace for the workspace
|
||||
* back-and-forth switching. */
|
||||
static char *previous_workspace_name = NULL;
|
||||
/*
|
||||
* Stores a copy of the name of the last used workspace for the workspace
|
||||
* back-and-forth switching.
|
||||
*
|
||||
*/
|
||||
char *previous_workspace_name = NULL;
|
||||
|
||||
/* NULL-terminated list of workspace names (in order) extracted from
|
||||
* keybindings. */
|
||||
|
Reference in New Issue
Block a user