From b343a55e686b9ce9fb5c41e13b12bea8aa627c55 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 28 Feb 2023 13:05:52 +0100 Subject: [PATCH] Match outputs by port in configuration --- sway/desktop/output.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 5006d794..1c2c983c 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -42,6 +42,13 @@ bool output_match_name_or_id(struct sway_output *output, return true; } + const char port_prefix[] = "port:"; + if (strncmp(name_or_id, port_prefix, strlen(port_prefix)) == 0) { + const char *port = &name_or_id[strlen(port_prefix)]; + return output->wlr_output->port != NULL && + strcmp(output->wlr_output->port, port) == 0; + } + char identifier[128]; output_get_identifier(identifier, sizeof(identifier), output); return strcasecmp(identifier, name_or_id) == 0