Merge pull request #20 from attente/allow-image-file-colons
Allow image file paths to contain colons
This commit is contained in:
commit
db577f8e67
6
main.c
6
main.c
@ -364,12 +364,12 @@ static cairo_surface_t *select_image(struct swaylock_state *state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void load_image(char *arg, struct swaylock_state *state) {
|
static void load_image(char *arg, struct swaylock_state *state) {
|
||||||
// [<output>:]<path>
|
// [[<output>]:]<path>
|
||||||
struct swaylock_image *image = calloc(1, sizeof(struct swaylock_image));
|
struct swaylock_image *image = calloc(1, sizeof(struct swaylock_image));
|
||||||
char *separator = strchr(arg, ':');
|
char *separator = strchr(arg, ':');
|
||||||
if (separator) {
|
if (separator) {
|
||||||
*separator = '\0';
|
*separator = '\0';
|
||||||
image->output_name = strdup(arg);
|
image->output_name = separator == arg ? NULL : strdup(arg);
|
||||||
image->path = strdup(separator + 1);
|
image->path = strdup(separator + 1);
|
||||||
} else {
|
} else {
|
||||||
image->output_name = NULL;
|
image->output_name = NULL;
|
||||||
@ -554,7 +554,7 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state,
|
|||||||
"Detach from the controlling terminal after locking.\n"
|
"Detach from the controlling terminal after locking.\n"
|
||||||
" -h, --help "
|
" -h, --help "
|
||||||
"Show help message and quit.\n"
|
"Show help message and quit.\n"
|
||||||
" -i, --image [<output>:]<path> "
|
" -i, --image [[<output>]:]<path> "
|
||||||
"Display the given image.\n"
|
"Display the given image.\n"
|
||||||
" -L, --disable-caps-lock-text "
|
" -L, --disable-caps-lock-text "
|
||||||
"Disable the Caps Lock text.\n"
|
"Disable the Caps Lock text.\n"
|
||||||
|
@ -43,9 +43,10 @@ Locks your Wayland session.
|
|||||||
*-u, --no-unlock-indicator*
|
*-u, --no-unlock-indicator*
|
||||||
Disable the unlock indicator.
|
Disable the unlock indicator.
|
||||||
|
|
||||||
*-i, --image* [<output>:]<path>
|
*-i, --image* [[<output>]:]<path>
|
||||||
Display the given image, optionally only on the given output. Use -c to set
|
Display the given image, optionally only on the given output. Use -c to set
|
||||||
a background color.
|
a background color. If the path potentially contains a ':', prefix it with another
|
||||||
|
':' to prevent interpreting part of it as <output>.
|
||||||
|
|
||||||
*-L, --disable-caps-lock-text*
|
*-L, --disable-caps-lock-text*
|
||||||
Disable the Caps Lock Text.
|
Disable the Caps Lock Text.
|
||||||
|
Loading…
Reference in New Issue
Block a user