summaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c11
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,
59 workspace->width = output->width; 59 workspace->width = output->width;
60 workspace->height = output->height; 60 workspace->height = output->height;
61 workspace->name = !name ? NULL : strdup(name); 61 workspace->name = !name ? NULL : strdup(name);
62 workspace->prev_layout = L_NONE; 62 workspace->prev_split_layout = L_NONE;
63 workspace->layout = container_get_default_layout(output); 63 workspace->layout = container_get_default_layout(output);
64 64
65 struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace)); 65 struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace));
@@ -250,6 +250,7 @@ struct sway_container *workspace_by_name(const char *name) {
250 current_workspace = container_parent(focus, C_WORKSPACE); 250 current_workspace = container_parent(focus, C_WORKSPACE);
251 current_output = container_parent(focus, C_OUTPUT); 251 current_output = container_parent(focus, C_OUTPUT);
252 } 252 }
253
253 if (strcmp(name, "prev") == 0) { 254 if (strcmp(name, "prev") == 0) {
254 return workspace_prev(current_workspace); 255 return workspace_prev(current_workspace);
255 } else if (strcmp(name, "prev_on_output") == 0) { 256 } else if (strcmp(name, "prev_on_output") == 0) {
@@ -260,6 +261,9 @@ struct sway_container *workspace_by_name(const char *name) {
260 return workspace_output_next(current_output); 261 return workspace_output_next(current_output);
261 } else if (strcmp(name, "current") == 0) { 262 } else if (strcmp(name, "current") == 0) {
262 return current_workspace; 263 return current_workspace;
264 } else if (strcasecmp(name, "back_and_forth") == 0) {
265 return prev_workspace_name ? container_find(&root_container,
266 _workspace_by_name, (void *)prev_workspace_name) : NULL;
263 } else { 267 } else {
264 return container_find(&root_container, _workspace_by_name, 268 return container_find(&root_container, _workspace_by_name,
265 (void *)name); 269 (void *)name);
@@ -364,7 +368,8 @@ struct sway_container *workspace_prev(struct sway_container *current) {
364 return workspace_prev_next_impl(current, false); 368 return workspace_prev_next_impl(current, false);
365} 369}
366 370
367bool workspace_switch(struct sway_container *workspace) { 371bool workspace_switch(struct sway_container *workspace,
372 bool no_auto_back_and_forth) {
368 if (!workspace) { 373 if (!workspace) {
369 return false; 374 return false;
370 } 375 }
@@ -379,7 +384,7 @@ bool workspace_switch(struct sway_container *workspace) {
379 active_ws = container_parent(focus, C_WORKSPACE); 384 active_ws = container_parent(focus, C_WORKSPACE);
380 } 385 }
381 386
382 if (config->auto_back_and_forth 387 if (!no_auto_back_and_forth && config->auto_back_and_forth
383 && active_ws == workspace 388 && active_ws == workspace
384 && prev_workspace_name) { 389 && prev_workspace_name) {
385 struct sway_container *new_ws = workspace_by_name(prev_workspace_name); 390 struct sway_container *new_ws = workspace_by_name(prev_workspace_name);