From 2ff86d013a59d72385aee2f23bcd64a16113ba7e Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 20 Dec 2018 11:53:10 -0500 Subject: [PATCH] Allow output identifier in move, focus, and assign This allows output identifiers to be used with the following commands: - `move container|window to output` - `focus output` - `assign [criteria] output` --- sway/commands/focus.c | 3 +++ sway/commands/move.c | 6 +++++- sway/tree/view.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 689edfec9..8f6a4b8a6 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -194,6 +194,9 @@ static struct cmd_results *focus_output(struct sway_seat *seat, } char *identifier = join_args(argv, argc); struct sway_output *output = output_by_name(identifier); + if (!output) { + output = output_by_identifier(identifier); + } if (!output) { enum wlr_direction direction; diff --git a/sway/commands/move.c b/sway/commands/move.c index 4dc547db7..ab0ca7a69 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -64,7 +64,11 @@ static struct sway_output *output_in_direction(const char *direction_string, } } - return output_by_name(direction_string); + struct sway_output *output = output_by_name(direction_string); + if (!output) { + output = output_by_identifier(direction_string); + } + return output; } static bool is_parallel(enum sway_container_layout layout, diff --git a/sway/tree/view.c b/sway/tree/view.c index e890f4f33..40e6470f7 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -460,6 +460,9 @@ static struct sway_workspace *select_workspace(struct sway_view *view) { struct criteria *criteria = criterias->items[i]; if (criteria->type == CT_ASSIGN_OUTPUT) { struct sway_output *output = output_by_name(criteria->target); + if (!output) { + output = output_by_identifier(criteria->target); + } if (output) { ws = output_get_active_workspace(output); break;