diff options
author | 2015-11-19 18:55:17 -0500 | |
---|---|---|
committer | 2015-11-19 18:55:17 -0500 | |
commit | 5728307520fe80b34067cf4d312409548d4a0a10 (patch) | |
tree | 4698561d5912c59930fe7f13519437bc02a8a2ad /sway | |
parent | Parse output background config (diff) | |
download | sway-5728307520fe80b34067cf4d312409548d4a0a10.tar.gz sway-5728307520fe80b34067cf4d312409548d4a0a10.tar.zst sway-5728307520fe80b34067cf4d312409548d4a0a10.zip |
Add wallpapers to output command
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config.c | 22 | ||||
-rw-r--r-- | sway/handlers.c | 5 |
2 files changed, 27 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) { | |||
314 | } | 314 | } |
315 | output->x = x; | 315 | output->x = x; |
316 | } | 316 | } |
317 | |||
318 | if (oc->background) { | ||
319 | int i; | ||
320 | for (i = 0; i < root_container.children->length; ++i) { | ||
321 | if (root_container.children->items[i] == output) { | ||
322 | break; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | sway_log(L_DEBUG, "Setting background for output %d to %s", i, oc->background); | ||
327 | char *cmd = malloc( | ||
328 | strlen("swaybg ") + | ||
329 | (i >= 10 ? 2 : 1) + | ||
330 | strlen(oc->background) + 3 + | ||
331 | strlen(oc->background_option) + 3 + | ||
332 | 1); | ||
333 | sprintf(cmd, "swaybg %d '%s' '%s'", i, oc->background, oc->background_option); | ||
334 | if (fork() == 0) { | ||
335 | execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); | ||
336 | } | ||
337 | free(cmd); | ||
338 | } | ||
317 | } | 339 | } |
318 | 340 | ||
319 | char *do_var_replacement(char *str) { | 341 | char *do_var_replacement(char *str) { |
diff --git a/sway/handlers.c b/sway/handlers.c index dde9b88b..28fa9564 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -43,6 +43,11 @@ static bool handle_output_created(wlc_handle output) { | |||
43 | swayc_t *ws = op->children->items[0]; | 43 | swayc_t *ws = op->children->items[0]; |
44 | workspace_switch(ws); | 44 | workspace_switch(ws); |
45 | } | 45 | } |
46 | |||
47 | // Fixes issues with backgrounds and wlc | ||
48 | wlc_handle prev = wlc_get_focused_output(); | ||
49 | wlc_output_focus(output); | ||
50 | wlc_output_focus(prev); | ||
46 | return true; | 51 | return true; |
47 | } | 52 | } |
48 | 53 | ||