Add new key "previous_workspace_name" to the json dump of the root container.
#define NET_WM_DESKTOP_NONE 0xFFFFFFF0
#define NET_WM_DESKTOP_ALL 0xFFFFFFFF
+/**
+ * Stores a copy of the name of the last used workspace for the workspace
+ * back-and-forth switching.
+ *
+ */
+extern char *previous_workspace_name;
+
/**
* Returns the workspace with the given name or NULL if such a workspace does
* not exist.
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);
}
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;
#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. */
cmd 'workspace back_and_forth';
is(focused_ws, '6: baz', 'workspace 6 now focused');
+################################################################################
+# See if BAF is preserved after restart
+################################################################################
+
+cmd 'restart';
+cmd 'workspace back_and_forth';
+is(focused_ws, '5: foo', 'workspace 5 focused after restart');
+
exit_gracefully($pid);
done_testing;