Allow changing the layout of workspaces by storing it (Thanks mhcerri)
Before commit 4976fa3350
, setting the
layout of workspaces to something else than the default would just mess
up the parent container of the workspace (the content container).
After that commit, it would create an unnecessary split container when
you change the layout _before_ opening any containers. To avoid this, we
now store the layout (similar to how the 'workspace_layout'
configuration directive works) and apply it when the first container is
attached to the workspace.
Fixes #796
This commit is contained in:
@ -211,6 +211,17 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
|
||||
json_node->layout = L_SPLITV;
|
||||
else LOG("Unhandled \"layout\": %s\n", buf);
|
||||
free(buf);
|
||||
} else if (strcasecmp(last_key, "workspace_layout") == 0) {
|
||||
char *buf = NULL;
|
||||
sasprintf(&buf, "%.*s", (int)len, val);
|
||||
if (strcasecmp(buf, "default") == 0)
|
||||
json_node->workspace_layout = L_DEFAULT;
|
||||
else if (strcasecmp(buf, "stacked") == 0)
|
||||
json_node->workspace_layout = L_STACKED;
|
||||
else if (strcasecmp(buf, "tabbed") == 0)
|
||||
json_node->workspace_layout = L_TABBED;
|
||||
else LOG("Unhandled \"workspace_layout\": %s\n", buf);
|
||||
free(buf);
|
||||
} else if (strcasecmp(last_key, "last_split_layout") == 0) {
|
||||
char *buf = NULL;
|
||||
sasprintf(&buf, "%.*s", (int)len, val);
|
||||
|
Reference in New Issue
Block a user