diff options
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 8b3eb2ad..b9780922 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -42,10 +42,16 @@ struct sway_output *workspace_get_initial_output(const char *name) { | |||
42 | } | 42 | } |
43 | } | 43 | } |
44 | } | 44 | } |
45 | // Otherwise put it on the focused output | 45 | // Otherwise try to put it on the focused output |
46 | struct sway_seat *seat = input_manager_current_seat(); | 46 | struct sway_seat *seat = input_manager_current_seat(); |
47 | struct sway_workspace *focus = seat_get_focused_workspace(seat); | 47 | struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); |
48 | return focus->output; | 48 | if (focus && focus->type == N_WORKSPACE) { |
49 | return focus->sway_workspace->output; | ||
50 | } else if (focus && focus->type == N_CONTAINER) { | ||
51 | return focus->sway_container->workspace->output; | ||
52 | } | ||
53 | // Fallback to the first output or noop output for headless | ||
54 | return root->outputs->length ? root->outputs->items[0] : root->noop_output; | ||
49 | } | 55 | } |
50 | 56 | ||
51 | static void prevent_invalid_outer_gaps(struct sway_workspace *ws) { | 57 | static void prevent_invalid_outer_gaps(struct sway_workspace *ws) { |