aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-11-28 10:18:37 -0500
committerDrew DeVault <sir@cmpwn.com>2015-11-28 10:18:37 -0500
commit1661edee2808f5d293ce89bf46bd87faff25d654 (patch)
tree60d4b04a3a118f792f4faf1f7a88eb78acbcb72b
parent2f192ccecabfaa4ab85f6cfb616380c571c67ce6 (diff)
Allow output config for output named *
Which will match any output.
-rw-r--r--sway.5.txt4
-rw-r--r--sway/config.c12
-rw-r--r--sway/container.c5
3 files changed, 20 insertions, 1 deletions
diff --git a/sway.5.txt b/sway.5.txt
index dc5e5d66..24467d22 100644
--- a/sway.5.txt
+++ b/sway.5.txt
@@ -140,6 +140,10 @@ Commands
You can get a list of output names like so:
+
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**::
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) {
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) {
int i;
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) {
sway_log(L_DEBUG, "Matched output config for %s", name);
break;
}
- oc = NULL;
+ if (strcasecmp("*", oc->name) == 0) {
+ sway_log(L_DEBUG, "Matched wildcard output config for %s", name);
+ break;
+ }
}
if (oc && !oc->enabled) {