Match outputs by port in configuration

This commit is contained in:
Simon Ser 2023-02-28 13:05:52 +01:00
parent 4e3a6015e8
commit b343a55e68

View file

@ -42,6 +42,13 @@ bool output_match_name_or_id(struct sway_output *output,
return true; 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]; char identifier[128];
output_get_identifier(identifier, sizeof(identifier), output); output_get_identifier(identifier, sizeof(identifier), output);
return strcasecmp(identifier, name_or_id) == 0 return strcasecmp(identifier, name_or_id) == 0