mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 05:54:11 +01:00
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.
This commit is contained in:
parent
3c77f066a5
commit
f32a002401
@ -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
|
// Check if there's any `assign` criteria for the view
|
||||||
list_t *criterias = criteria_for_view(view,
|
list_t *criterias = criteria_for_view(view,
|
||||||
CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT);
|
CT_ASSIGN_WORKSPACE | CT_ASSIGN_OUTPUT);
|
||||||
|
struct sway_container *workspace = NULL;
|
||||||
if (criterias->length) {
|
if (criterias->length) {
|
||||||
struct criteria *criteria = criterias->items[0];
|
struct criteria *criteria = criterias->items[0];
|
||||||
if (criteria->type == CT_ASSIGN_WORKSPACE) {
|
if (criteria->type == CT_ASSIGN_WORKSPACE) {
|
||||||
struct sway_container *workspace = workspace_by_name(criteria->target);
|
workspace = workspace_by_name(criteria->target);
|
||||||
if (!workspace) {
|
if (!workspace) {
|
||||||
workspace = workspace_create(NULL, criteria->target);
|
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);
|
arrange_children_of(cont->parent);
|
||||||
input_manager_set_focus(input_manager, cont);
|
input_manager_set_focus(input_manager, cont);
|
||||||
|
if (workspace) {
|
||||||
|
workspace_switch(workspace);
|
||||||
|
}
|
||||||
|
|
||||||
view_update_title(view, false);
|
view_update_title(view, false);
|
||||||
container_notify_child_title_changed(view->swayc->parent);
|
container_notify_child_title_changed(view->swayc->parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user