diff options
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index cc225e79..3fcad631 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -59,7 +59,7 @@ struct sway_container *workspace_create(struct sway_container *output, workspace->width = output->width; workspace->height = output->height; workspace->name = !name ? NULL : strdup(name); - workspace->prev_layout = L_NONE; + workspace->prev_split_layout = L_NONE; workspace->layout = container_get_default_layout(output); struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace)); @@ -250,6 +250,7 @@ struct sway_container *workspace_by_name(const char *name) { current_workspace = container_parent(focus, C_WORKSPACE); current_output = container_parent(focus, C_OUTPUT); } + if (strcmp(name, "prev") == 0) { return workspace_prev(current_workspace); } else if (strcmp(name, "prev_on_output") == 0) { @@ -260,6 +261,9 @@ struct sway_container *workspace_by_name(const char *name) { return workspace_output_next(current_output); } else if (strcmp(name, "current") == 0) { return current_workspace; + } else if (strcasecmp(name, "back_and_forth") == 0) { + return prev_workspace_name ? container_find(&root_container, + _workspace_by_name, (void *)prev_workspace_name) : NULL; } else { return container_find(&root_container, _workspace_by_name, (void *)name); @@ -364,7 +368,8 @@ struct sway_container *workspace_prev(struct sway_container *current) { return workspace_prev_next_impl(current, false); } -bool workspace_switch(struct sway_container *workspace) { +bool workspace_switch(struct sway_container *workspace, + bool no_auto_back_and_forth) { if (!workspace) { return false; } @@ -379,7 +384,7 @@ bool workspace_switch(struct sway_container *workspace) { active_ws = container_parent(focus, C_WORKSPACE); } - if (config->auto_back_and_forth + if (!no_auto_back_and_forth && config->auto_back_and_forth && active_ws == workspace && prev_workspace_name) { struct sway_container *new_ws = workspace_by_name(prev_workspace_name); |