aboutsummaryrefslogtreecommitdiffstats
path: root/swaybg
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 18:55:17 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 18:55:17 -0500
commit5728307520fe80b34067cf4d312409548d4a0a10 (patch)
tree4698561d5912c59930fe7f13519437bc02a8a2ad /swaybg
parentParse output background config (diff)
downloadsway-5728307520fe80b34067cf4d312409548d4a0a10.tar.gz
sway-5728307520fe80b34067cf4d312409548d4a0a10.tar.zst
sway-5728307520fe80b34067cf4d312409548d4a0a10.zip
Add wallpapers to output command
Diffstat (limited to 'swaybg')
-rw-r--r--swaybg/main.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/swaybg/main.c b/swaybg/main.c
index 080422e5..5a12eec6 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -28,28 +28,29 @@ int main(int argc, char **argv) {
28 surfaces = create_list(); 28 surfaces = create_list();
29 registry = registry_poll(); 29 registry = registry_poll();
30 30
31 if (argc < 2) { 31 if (argc < 4) {
32 sway_abort("Usage: swaybg path/to/file.png"); 32 sway_abort("Do not run this program manually. See man 5 sway and look for output options.");
33 } 33 }
34 34
35 if (!registry->desktop_shell) { 35 if (!registry->desktop_shell) {
36 sway_abort("swaybg requires the compositor to support the desktop-shell extension."); 36 sway_abort("swaybg requires the compositor to support the desktop-shell extension.");
37 } 37 }
38 38
39 int desired_output = atoi(argv[1]);
40 sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length);
39 int i; 41 int i;
40 for (i = 0; i < registry->outputs->length; ++i) { 42 struct output_state *output = registry->outputs->items[desired_output];
41 struct output_state *output = registry->outputs->items[i]; 43 struct window *window = window_setup(registry, 100, 100, false);
42 struct window *window = window_setup(registry, 100, 100, false); 44 if (!window) {
43 if (!window) { 45 sway_abort("Failed to create surfaces.");
44 sway_abort("Failed to create surfaces.");
45 }
46 window->width = output->width;
47 window->height = output->height;
48 desktop_shell_set_background(registry->desktop_shell, output->output, window->surface);
49 list_add(surfaces, window);
50 } 46 }
47 window->width = output->width;
48 window->height = output->height;
49 desktop_shell_set_background(registry->desktop_shell, output->output, window->surface);
50 list_add(surfaces, window);
51 51
52 cairo_surface_t *image = cairo_image_surface_create_from_png(argv[1]); 52 char *scaling_mode = argv[3];
53 cairo_surface_t *image = cairo_image_surface_create_from_png(argv[2]);
53 double width = cairo_image_surface_get_width(image); 54 double width = cairo_image_surface_get_width(image);
54 double height = cairo_image_surface_get_height(image); 55 double height = cairo_image_surface_get_height(image);
55 56