aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-25 22:26:13 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-25 22:28:01 +1000
commitf32a00240143d8696705ba626acd58c581523bbf (patch)
tree4d7af27dd7db578645c409599b0291317fe7831d
parent3c77f066a532efd3df0f2072d02fa4353b4a4511 (diff)
Switch workspace if required when mapping a view
If a view is created on a workspace that wasn't visible, switch to it. Fixes #1879.
-rw-r--r--sway/tree/view.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 07157818..349a16a4 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -438,10 +438,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
// Check if there's any `assign` criteria for the view
list_t *criterias = criteria_for_view(view,
CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT);
+ struct sway_container *workspace = NULL;
if (criterias->length) {
struct criteria *criteria = criterias->items[0];
if (criteria->type == CT_ASSIGN_WORKSPACE) {
- struct sway_container *workspace = workspace_by_name(criteria->target);
+ workspace = workspace_by_name(criteria->target);
if (!workspace) {
workspace = workspace_create(NULL, criteria->target);
}
@@ -468,6 +469,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
arrange_children_of(cont->parent);
input_manager_set_focus(input_manager, cont);
+ if (workspace) {
+ workspace_switch(workspace);
+ }
view_update_title(view, false);
container_notify_child_title_changed(view->swayc->parent);