aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 22:26:13 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 22:28:01 +1000
commitf32a00240143d8696705ba626acd58c581523bbf (patch)
tree4d7af27dd7db578645c409599b0291317fe7831d /sway/tree/view.c
parentMerge pull request #2028 from RyanDwyer/fix-move-workspace (diff)
downloadsway-f32a00240143d8696705ba626acd58c581523bbf.tar.gz
sway-f32a00240143d8696705ba626acd58c581523bbf.tar.zst
sway-f32a00240143d8696705ba626acd58c581523bbf.zip
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.
Diffstat (limited to 'sway/tree/view.c')
-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) {
438 // Check if there's any `assign` criteria for the view 438 // Check if there's any `assign` criteria for the view
439 list_t *criterias = criteria_for_view(view, 439 list_t *criterias = criteria_for_view(view,
440 CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT); 440 CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT);
441 struct sway_container *workspace = NULL;
441 if (criterias->length) { 442 if (criterias->length) {
442 struct criteria *criteria = criterias->items[0]; 443 struct criteria *criteria = criterias->items[0];
443 if (criteria->type == CT_ASSIGN_WORKSPACE) { 444 if (criteria->type == CT_ASSIGN_WORKSPACE) {
444 struct sway_container *workspace = workspace_by_name(criteria->target); 445 workspace = workspace_by_name(criteria->target);
445 if (!workspace) { 446 if (!workspace) {
446 workspace = workspace_create(NULL, criteria->target); 447 workspace = workspace_create(NULL, criteria->target);
447 } 448 }
@@ -468,6 +469,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
468 469
469 arrange_children_of(cont->parent); 470 arrange_children_of(cont->parent);
470 input_manager_set_focus(input_manager, cont); 471 input_manager_set_focus(input_manager, cont);
472 if (workspace) {
473 workspace_switch(workspace);
474 }
471 475
472 view_update_title(view, false); 476 view_update_title(view, false);
473 container_notify_child_title_changed(view->swayc->parent); 477 container_notify_child_title_changed(view->swayc->parent);