From 778745684561288e16592159e6e1ed21b83f1b96 Mon Sep 17 00:00:00 2001 From: qikiqi <11520039+qikiqi@users.noreply.github.com> Date: Sat, 17 Feb 2018 15:31:04 +0200 Subject: [PATCH] Add option to set custom 'no input' text --- i3lock.1 | 4 ++++ i3lock.c | 5 +++++ unlock_indicator.c | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/i3lock.1 b/i3lock.1 index 9293d38..a2eb94e 100644 --- a/i3lock.1 +++ b/i3lock.1 @@ -304,6 +304,10 @@ Sets the string to be shown while verifying the password/input/key/etc. Defaults .B \-\-wrongtext="text" Sets the string to be shown upon entering an incorrect password. Defaults to "wrong!". +.TP +.B \-\-noinputtext="text" +Sets the string to be shown upon pressing backspace without anything to delete. Defaults to "no input". + .TP .B \-\-radius The radius of the circle. Defaults to 90. diff --git a/i3lock.c b/i3lock.c index 42ed4e5..231f1b8 100644 --- a/i3lock.c +++ b/i3lock.c @@ -154,6 +154,7 @@ double ring_width = 7.0; char* verif_text = "verifying…"; char* wrong_text = "wrong!"; +char* noinput_text = "no input"; int keylayout_mode = -1; char* layout_text = NULL; @@ -1130,6 +1131,7 @@ int main(int argc, char *argv[]) { {"veriftext", required_argument, NULL, 0}, {"wrongtext", required_argument, NULL, 0}, + {"noinputtext", required_argument, NULL, 0}, {"modsize", required_argument, NULL, 0}, {"radius", required_argument, NULL, 0}, {"ring-width", required_argument, NULL, 0}, @@ -1546,6 +1548,9 @@ int main(int argc, char *argv[]) { else if (strcmp(longopts[longoptind].name, "wrongtext") == 0) { wrong_text = optarg; } + else if (strcmp(longopts[longoptind].name, "noinputtext") == 0) { + noinput_text = optarg; + } else if (strcmp(longopts[longoptind].name, "verifsize") == 0) { char *arg = optarg; diff --git a/unlock_indicator.c b/unlock_indicator.c index 96ac4b8..528e406 100644 --- a/unlock_indicator.c +++ b/unlock_indicator.c @@ -119,6 +119,7 @@ extern double layout_size; extern char *verif_text; extern char *wrong_text; +extern char *noinput_text; extern char *layout_text; /* Whether the failed attempts should be displayed. */ @@ -749,7 +750,7 @@ xcb_pixmap_t draw_image(uint32_t *resolution) { default: if (unlock_state == STATE_NOTHING_TO_DELETE) { draw_data.status_text.show = true; - strncpy(draw_data.status_text.str, "no input", sizeof(draw_data.status_text.str)); + strncpy(draw_data.status_text.str, noinput_text, sizeof(draw_data.status_text.str)); draw_data.status_text.font = get_font_face(WRONG_FONT); draw_data.status_text.color = wrong16; draw_data.status_text.size = wrong_size;