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`
This commit is contained in:
Brian Ashworth 2018-12-20 11:53:10 -05:00
parent 477bca5e28
commit 2ff86d013a
3 changed files with 11 additions and 1 deletions

View file

@ -194,6 +194,9 @@ static struct cmd_results *focus_output(struct sway_seat *seat,
} }
char *identifier = join_args(argv, argc); char *identifier = join_args(argv, argc);
struct sway_output *output = output_by_name(identifier); struct sway_output *output = output_by_name(identifier);
if (!output) {
output = output_by_identifier(identifier);
}
if (!output) { if (!output) {
enum wlr_direction direction; enum wlr_direction direction;

View file

@ -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, static bool is_parallel(enum sway_container_layout layout,

View file

@ -460,6 +460,9 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
struct criteria *criteria = criterias->items[i]; struct criteria *criteria = criterias->items[i];
if (criteria->type == CT_ASSIGN_OUTPUT) { if (criteria->type == CT_ASSIGN_OUTPUT) {
struct sway_output *output = output_by_name(criteria->target); struct sway_output *output = output_by_name(criteria->target);
if (!output) {
output = output_by_identifier(criteria->target);
}
if (output) { if (output) {
ws = output_get_active_workspace(output); ws = output_get_active_workspace(output);
break; break;