diff --git a/include/swaylock.h b/include/swaylock.h index c373fff1..dc5104ad 100644 --- a/include/swaylock.h +++ b/include/swaylock.h @@ -118,6 +118,7 @@ struct swaylock_surface { int32_t scale; enum wl_output_subpixel subpixel; char *output_name; + char *output_description; struct wl_list link; // Dimensions of last wl_buffer committed to background surface int last_buffer_width, last_buffer_height; diff --git a/main.c b/main.c index 549d6f64..b56fe41b 100644 --- a/main.c +++ b/main.c @@ -259,7 +259,8 @@ static void handle_wl_output_name(void *data, struct wl_output *output, static void handle_wl_output_description(void *data, struct wl_output *output, const char *description) { - // Who cares + struct swaylock_surface *surface = data; + surface->output_description = strdup(description); } struct wl_output_listener _wl_output_listener = { @@ -349,7 +350,7 @@ static cairo_surface_t *select_image(struct swaylock_state *state, struct swaylock_image *image; cairo_surface_t *default_image = NULL; wl_list_for_each(image, &state->images, link) { - if (lenient_strcmp(image->output_name, surface->output_name) == 0) { + if (lenient_strcmp(image->output_name, surface->output_name) == 0 || strstr(surface->output_description, image->output_name) != 0) { return image->cairo_surface; } else if (!image->output_name) { default_image = image->cairo_surface;