Allow output config for output named *

Which will match any output.
This commit is contained in:
Drew DeVault 2015-11-28 10:18:37 -05:00
parent 2f192cceca
commit 1661edee28
3 changed files with 20 additions and 1 deletions

View file

@ -140,6 +140,10 @@ Commands
You can get a list of output names like so: You can get a list of output names like so:
+ +
swaymsg -t get_outputs swaymsg -t get_outputs
+
You may also match any output by using the output name "*". Be sure to add
this output config after the others, or it will be matched instead of the
others.
**reload**:: **reload**::
Reloads the sway config file without restarting sway. Reloads the sway config file without restarting sway.

View file

@ -289,6 +289,18 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
output->x = x; output->x = x;
} }
if (!oc || !oc->background) {
// Look for a * config for background
int i;
for (i = 0; i < config->output_configs->length; ++i) {
oc = config->output_configs->items[i];
if (strcasecmp("*", oc->name) == 0) {
break;
}
oc = NULL;
}
}
if (oc && oc->background) { if (oc && oc->background) {
int i; int i;
for (i = 0; i < root_container.children->length; ++i) { for (i = 0; i < root_container.children->length; ++i) {

View file

@ -87,7 +87,10 @@ swayc_t *new_output(wlc_handle handle) {
sway_log(L_DEBUG, "Matched output config for %s", name); sway_log(L_DEBUG, "Matched output config for %s", name);
break; break;
} }
oc = NULL; if (strcasecmp("*", oc->name) == 0) {
sway_log(L_DEBUG, "Matched wildcard output config for %s", name);
break;
}
} }
if (oc && !oc->enabled) { if (oc && !oc->enabled) {