summaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2015-11-19 18:55:17 -0500
committerDrew DeVault <[email protected]>2015-11-19 18:55:17 -0500
commit5728307520fe80b34067cf4d312409548d4a0a10 (patch)
tree4698561d5912c59930fe7f13519437bc02a8a2ad /sway/config.c
parent79b277fe9b3f637fa9a1bd47e73218b3cb2cd5bd (diff)
Add wallpapers to output command
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c
index ce6d8baf..2c9cc290 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -314,6 +314,28 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
}
output->x = x;
}
+
+ if (oc->background) {
+ int i;
+ for (i = 0; i < root_container.children->length; ++i) {
+ if (root_container.children->items[i] == output) {
+ break;
+ }
+ }
+
+ sway_log(L_DEBUG, "Setting background for output %d to %s", i, oc->background);
+ char *cmd = malloc(
+ strlen("swaybg ") +
+ (i >= 10 ? 2 : 1) +
+ strlen(oc->background) + 3 +
+ strlen(oc->background_option) + 3 +
+ 1);
+ sprintf(cmd, "swaybg %d '%s' '%s'", i, oc->background, oc->background_option);
+ if (fork() == 0) {
+ execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL);
+ }
+ free(cmd);
+ }
}
char *do_var_replacement(char *str) {