When the workspace is focused, return it instead of checking parent

This commit is contained in:
Donnie West 2018-08-15 21:49:40 -05:00
parent 98ed05225e
commit a9433cbded
No known key found for this signature in database
GPG key ID: 4D68D3B74B710AD4

View file

@ -258,7 +258,8 @@ struct sway_container *workspace_by_name(const char *name) {
struct sway_container *current_workspace = NULL, *current_output = NULL; struct sway_container *current_workspace = NULL, *current_output = NULL;
struct sway_container *focus = seat_get_focus(seat); struct sway_container *focus = seat_get_focus(seat);
if (focus) { if (focus) {
current_workspace = container_parent(focus, C_WORKSPACE); current_workspace = focus->type == C_WORKSPACE ?
focus : container_parent(focus, C_WORKSPACE);
current_output = container_parent(focus, C_OUTPUT); current_output = container_parent(focus, C_OUTPUT);
} }