Browse Source

Merge pull request #91 from aloomis/master

Text customization for the locking and lock failed states.
master
Cassandra 7 years ago
committed by GitHub
parent
commit
a6be8397ad
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      i3lock.1
  2. 12
      i3lock.c
  3. 6
      unlock_indicator.c

8
i3lock.1

@ -308,6 +308,14 @@ Sets the string to be shown upon entering an incorrect password. Defaults to "wr
.B \-\-noinputtext="text" .B \-\-noinputtext="text"
Sets the string to be shown upon pressing backspace without anything to delete. Defaults to "no input". Sets the string to be shown upon pressing backspace without anything to delete. Defaults to "no input".
.TP
.B \-\-locktext="text"
Sets the string to be shown while acquiring pointer and keyboard focus. Defaults to "locking…".
.TP
.B \-\-lockfailedtext="text"
Sets the string to be shown after failing to acquire pointer and keyboard focus. Defaults to "lock failed!".
.TP .TP
.B \-\-radius .B \-\-radius
The radius of the circle. Defaults to 90. The radius of the circle. Defaults to 90.

12
i3lock.c

@ -162,6 +162,8 @@ double ring_width = 7.0;
char* verif_text = "verifying…"; char* verif_text = "verifying…";
char* wrong_text = "wrong!"; char* wrong_text = "wrong!";
char* noinput_text = "no input"; char* noinput_text = "no input";
char* lock_text = "locking…";
char* lock_failed_text = "lock failed!";
int keylayout_mode = -1; int keylayout_mode = -1;
char* layout_text = NULL; char* layout_text = NULL;
@ -652,7 +654,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
return; return;
} }
} }
// return/enter/etc // return/enter/etc
switch (ksym) { switch (ksym) {
case XKB_KEY_j: case XKB_KEY_j:
@ -1225,6 +1227,8 @@ int main(int argc, char *argv[]) {
{"wrongtext", required_argument, NULL, 513}, {"wrongtext", required_argument, NULL, 513},
{"keylayout", required_argument, NULL, 514}, {"keylayout", required_argument, NULL, 514},
{"noinputtext", required_argument, NULL, 515}, {"noinputtext", required_argument, NULL, 515},
{"locktext", required_argument, NULL, 516},
{"lockfailedtext", required_argument, NULL, 517},
// fonts // fonts
@ -1502,6 +1506,12 @@ int main(int argc, char *argv[]) {
case 515: case 515:
noinput_text = optarg; noinput_text = optarg;
break; break;
case 516:
lock_text = optarg;
break;
case 517:
lock_failed_text = optarg;
break;
// font stuff // font stuff
case 520: case 520:
if (strlen(optarg) > 31) { if (strlen(optarg) > 31) {

6
unlock_indicator.c

@ -130,6 +130,8 @@ extern double layout_size;
extern char *verif_text; extern char *verif_text;
extern char *wrong_text; extern char *wrong_text;
extern char *noinput_text; extern char *noinput_text;
extern char *lock_text;
extern char *lock_failed_text;
extern char *layout_text; extern char *layout_text;
/* Whether the failed attempts should be displayed. */ /* Whether the failed attempts should be displayed. */
@ -758,7 +760,7 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
break; break;
case STATE_AUTH_LOCK: case STATE_AUTH_LOCK:
draw_data.status_text.show = true; draw_data.status_text.show = true;
strncpy(draw_data.status_text.str, "locking…", sizeof(draw_data.status_text.str)); strncpy(draw_data.status_text.str, lock_text, sizeof(draw_data.status_text.str));
draw_data.status_text.font = get_font_face(VERIF_FONT); draw_data.status_text.font = get_font_face(VERIF_FONT);
draw_data.status_text.color = verif16; draw_data.status_text.color = verif16;
draw_data.status_text.size = verif_size; draw_data.status_text.size = verif_size;
@ -774,7 +776,7 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
break; break;
case STATE_I3LOCK_LOCK_FAILED: case STATE_I3LOCK_LOCK_FAILED:
draw_data.status_text.show = true; draw_data.status_text.show = true;
strncpy(draw_data.status_text.str, "lock failed!", sizeof(draw_data.status_text.str)); strncpy(draw_data.status_text.str, lock_failed_text, sizeof(draw_data.status_text.str));
draw_data.status_text.font = get_font_face(WRONG_FONT); draw_data.status_text.font = get_font_face(WRONG_FONT);
draw_data.status_text.color = wrong16; draw_data.status_text.color = wrong16;
draw_data.status_text.size = wrong_size; draw_data.status_text.size = wrong_size;

Loading…
Cancel
Save