diff options
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r-- | sway/commands/focus.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 76d3f1dc..6659a683 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -39,21 +39,24 @@ static struct cmd_results *focus_mode(struct sway_container *con, // If the container is in a floating split container, // operate on the split container instead of the child. if (container_is_floating_or_child(con)) { - while (con->parent->layout != L_FLOATING) { + while (con->parent->type != C_WORKSPACE) { con = con->parent; } } struct sway_container *new_focus = NULL; if (floating) { - new_focus = seat_get_focus_inactive(seat, ws->sway_workspace->floating); + new_focus = seat_get_focus_inactive_floating(seat, ws); } else { new_focus = seat_get_focus_inactive_tiling(seat, ws); } - if (!new_focus) { - new_focus = ws; + if (new_focus) { + seat_set_focus(seat, new_focus); + } else { + return cmd_results_new(CMD_FAILURE, "focus", + "Failed to find a %s container in workspace", + floating ? "floating" : "tiling"); } - seat_set_focus(seat, new_focus); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |