summaryrefslogtreecommitdiffstats
path: root/swaylock
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-20 22:39:08 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-20 22:54:09 +1000
commitbde9711f3cea13a0283f7c2b5b5aa1deb91edf41 (patch)
tree890e24a77527bac7633cb15327a4ed95bede05b6 /swaylock
parentSwaylock: Allow per-output images (diff)
downloadsway-bde9711f3cea13a0283f7c2b5b5aa1deb91edf41.tar.gz
sway-bde9711f3cea13a0283f7c2b5b5aa1deb91edf41.tar.zst
sway-bde9711f3cea13a0283f7c2b5b5aa1deb91edf41.zip
Swaylock: Log error if multiple images are defined for the same output
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 91c28bd2..74a00a35 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -223,6 +223,23 @@ static void load_image(char *arg, struct swaylock_state *state) {
223 image->path = strdup(arg); 223 image->path = strdup(arg);
224 } 224 }
225 225
226 bool exists = false;
227 struct swaylock_image *iter_image;
228 wl_list_for_each(iter_image, &state->images, link) {
229 if (lenient_strcmp(iter_image->output_name, image->output_name) == 0) {
230 exists = true;
231 break;
232 }
233 }
234 if (exists) {
235 if (image->output_name) {
236 wlr_log(L_ERROR, "Multiple images defined for output %s",
237 image->output_name);
238 } else {
239 wlr_log(L_ERROR, "Multiple default images defined");
240 }
241 }
242
226 // Bash doesn't replace the ~ with $HOME if the output name is supplied 243 // Bash doesn't replace the ~ with $HOME if the output name is supplied
227 wordexp_t p; 244 wordexp_t p;
228 if (wordexp(image->path, &p, 0) == 0) { 245 if (wordexp(image->path, &p, 0) == 0) {