diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-28 10:18:37 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-28 10:18:37 -0500 |
commit | 1661edee2808f5d293ce89bf46bd87faff25d654 (patch) | |
tree | 60d4b04a3a118f792f4faf1f7a88eb78acbcb72b | |
parent | Improve config file loading (diff) | |
download | sway-1661edee2808f5d293ce89bf46bd87faff25d654.tar.gz sway-1661edee2808f5d293ce89bf46bd87faff25d654.tar.zst sway-1661edee2808f5d293ce89bf46bd87faff25d654.zip |
Allow output config for output named *
Which will match any output.
-rw-r--r-- | sway.5.txt | 4 | ||||
-rw-r--r-- | sway/config.c | 12 | ||||
-rw-r--r-- | sway/container.c | 5 |
3 files changed, 20 insertions, 1 deletions
@@ -140,6 +140,10 @@ Commands | |||
140 | You can get a list of output names like so: | 140 | You can get a list of output names like so: |
141 | + | 141 | + |
142 | swaymsg -t get_outputs | 142 | swaymsg -t get_outputs |
143 | + | ||
144 | You may also match any output by using the output name "*". Be sure to add | ||
145 | this output config after the others, or it will be matched instead of the | ||
146 | others. | ||
143 | 147 | ||
144 | **reload**:: | 148 | **reload**:: |
145 | Reloads the sway config file without restarting sway. | 149 | Reloads the sway config file without restarting sway. |
diff --git a/sway/config.c b/sway/config.c index 5f8e4d6a..e9785aba 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -289,6 +289,18 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
289 | output->x = x; | 289 | output->x = x; |
290 | } | 290 | } |
291 | 291 | ||
292 | if (!oc || !oc->background) { | ||
293 | // Look for a * config for background | ||
294 | int i; | ||
295 | for (i = 0; i < config->output_configs->length; ++i) { | ||
296 | oc = config->output_configs->items[i]; | ||
297 | if (strcasecmp("*", oc->name) == 0) { | ||
298 | break; | ||
299 | } | ||
300 | oc = NULL; | ||
301 | } | ||
302 | } | ||
303 | |||
292 | if (oc && oc->background) { | 304 | if (oc && oc->background) { |
293 | int i; | 305 | int i; |
294 | for (i = 0; i < root_container.children->length; ++i) { | 306 | for (i = 0; i < root_container.children->length; ++i) { |
diff --git a/sway/container.c b/sway/container.c index ba37d7c8..3315fd93 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -87,7 +87,10 @@ swayc_t *new_output(wlc_handle handle) { | |||
87 | sway_log(L_DEBUG, "Matched output config for %s", name); | 87 | sway_log(L_DEBUG, "Matched output config for %s", name); |
88 | break; | 88 | break; |
89 | } | 89 | } |
90 | oc = NULL; | 90 | if (strcasecmp("*", oc->name) == 0) { |
91 | sway_log(L_DEBUG, "Matched wildcard output config for %s", name); | ||
92 | break; | ||
93 | } | ||
91 | } | 94 | } |
92 | 95 | ||
93 | if (oc && !oc->enabled) { | 96 | if (oc && !oc->enabled) { |