diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-06 11:30:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 11:30:14 -0400 |
commit | 1a8bee68b40f641f57adc97d0f2ffcf5e2ed544d (patch) | |
tree | 3df803a95c0a13f4dc9b627db505ba50d5e6a6d2 /sway/tree/workspace.c | |
parent | 0cd418ba42bf7fa9570a2c1c09cea153d3337c7a (diff) | |
parent | f7c21451dfa7c4ffdce1307b5856707a0ed40405 (diff) | |
download | sway-1a8bee68b40f641f57adc97d0f2ffcf5e2ed544d.tar.xz |
Merge pull request #2392 from ianyfan/commands
Fix commands: criteria, layout, move, workspace
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); |