From 3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Fri, 15 Mar 2019 15:09:55 -0400 Subject: Fix output config retrieval for new outputs This removes `output_find_config`, which would take the first matching output config it found. This is fine if only a name output config, identifier output config, or even just wildcard exist, but if there is a name output config and identifier output config, they are not merged. Instead, this introduces find_output_config, which is just a wrapper for `get_output_config`. This ensures that both the name and identifier output configs are respected. This fixes the following case: - For simplicity in this example, remove all output configs from config - Run `swaymsg output bg #ff0000 solid_color` - Run `swaymsg output scale 2` - Disconnect and reconnect output Without this, the output will have the background, but not the scale. With this, the output will have both the background and scale --- sway/config/output.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sway/config') diff --git a/sway/config/output.c b/sway/config/output.c index 1f55fd6a..a20c5ad4 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -438,6 +438,12 @@ static struct output_config *get_output_config(char *identifier, return result; } +struct output_config *find_output_config(struct sway_output *output) { + char id[128]; + output_get_identifier(id, sizeof(id), output); + return get_output_config(id, output); +} + void apply_output_config_to_outputs(struct output_config *oc) { // Try to find the output container and apply configuration now. If // this is during startup then there will be no container and config -- cgit v1.2.3