aboutsummaryrefslogtreecommitdiff
path: root/swaylock/main.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-20 22:39:08 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-20 22:54:09 +1000
commitbde9711f3cea13a0283f7c2b5b5aa1deb91edf41 (patch)
tree890e24a77527bac7633cb15327a4ed95bede05b6 /swaylock/main.c
parent9d99e5c2e72a464554b034c014437a495bb7b409 (diff)
Swaylock: Log error if multiple images are defined for the same output
Diffstat (limited to 'swaylock/main.c')
-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) {
image->path = strdup(arg);
}
+ bool exists = false;
+ struct swaylock_image *iter_image;
+ wl_list_for_each(iter_image, &state->images, link) {
+ if (lenient_strcmp(iter_image->output_name, image->output_name) == 0) {
+ exists = true;
+ break;
+ }
+ }
+ if (exists) {
+ if (image->output_name) {
+ wlr_log(L_ERROR, "Multiple images defined for output %s",
+ image->output_name);
+ } else {
+ wlr_log(L_ERROR, "Multiple default images defined");
+ }
+ }
+
// Bash doesn't replace the ~ with $HOME if the output name is supplied
wordexp_t p;
if (wordexp(image->path, &p, 0) == 0) {