aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorBrian Ashworth <RedSoxFan@users.noreply.github.com>2018-08-06 11:47:00 -0400
committerGitHub <noreply@github.com>2018-08-06 11:47:00 -0400
commit639f3368e101b697aaf3715b1213ea30766ff4ed (patch)
tree67dfb7bc19eb3dd27252d8b0f493436250b4fdea /sway/tree
parentf57a3919cf5ad7c3edbf9e2e19051971a5f2d42f (diff)
parentd8b65193c493e5826383a08593395a598ce4b503 (diff)
Merge branch 'master' into workspace-move-to-output
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/layout.c4
-rw-r--r--sway/tree/view.c18
-rw-r--r--sway/tree/workspace.c11
3 files changed, 27 insertions, 6 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 9485e675..20815654 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -843,7 +843,7 @@ struct sway_container *container_split(struct sway_container *child,
}
if (child->type == C_WORKSPACE && child->children->length == 0) {
// Special case: this just behaves like splitt
- child->prev_layout = child->layout;
+ child->prev_split_layout = child->layout;
child->layout = layout;
return child;
}
@@ -854,7 +854,7 @@ struct sway_container *container_split(struct sway_container *child,
remove_gaps(child);
- cont->prev_layout = L_NONE;
+ cont->prev_split_layout = L_NONE;
cont->width = child->width;
cont->height = child->height;
cont->x = child->x;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 9465b3a1..faaa53a1 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -1,5 +1,6 @@
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
+#include <strings.h>
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
@@ -456,7 +457,13 @@ static struct sway_container *select_workspace(struct sway_view *view) {
if (criteria->type == CT_ASSIGN_WORKSPACE) {
ws = workspace_by_name(criteria->target);
if (!ws) {
- ws = workspace_create(NULL, criteria->target);
+ if (strcasecmp(criteria->target, "back_and_forth") == 0) {
+ if (prev_workspace_name) {
+ ws = workspace_create(NULL, prev_workspace_name);
+ }
+ } else {
+ ws = workspace_create(NULL, criteria->target);
+ }
}
break;
} else {
@@ -891,6 +898,15 @@ static bool find_by_mark_iterator(struct sway_container *con,
return con->type == C_VIEW && view_has_mark(con->sway_view, mark);
}
+struct sway_view *view_find_mark(char *mark) {
+ struct sway_container *container = container_find(&root_container,
+ find_by_mark_iterator, mark);
+ if (!container) {
+ return NULL;
+ }
+ return container->sway_view;
+}
+
bool view_find_and_unmark(char *mark) {
struct sway_container *container = container_find(&root_container,
find_by_mark_iterator, mark);
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);