summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i3lock.110
-rw-r--r--i3lock.c11
2 files changed, 20 insertions, 1 deletions
diff --git a/i3lock.1 b/i3lock.1
index 8bc00f5..9c349b1 100644
--- a/i3lock.1
+++ b/i3lock.1
@@ -27,6 +27,7 @@ i3lock \- improved screen locker
.RB [\|\-p
.IR pointer\|]
.RB [\|\-u\|]
+.RB [\|\-e\|]
.SH DESCRIPTION
.B i3lock
@@ -100,6 +101,15 @@ does not hide your Mousepointer. If you specify "win",
displays a hardcoded Windows-Pointer (thus enabling you to fuck with your
friends by using a Screenshot of a Windows-Desktop as a locking-screen).
+.TP
+.B \-e, \-\-ignore-empty-password
+When an empty password is provided by the user, do not validate
+it. Without this option, the empty password will be provided to PAM
+and, if invalid, the user will have to wait a few seconds before
+another try. This can be useful if the XF86ScreenSaver key is used to
+put a laptop to sleep and bounce on resume or if you happen to wake up
+your computer with the enter key.
+
.SH SEE ALSO
.IR xautolock(1)
\- use i3lock as your screen saver
diff --git a/i3lock.c b/i3lock.c
index e5654d6..a4e0870 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -60,6 +60,7 @@ static struct xkb_keymap *xkb_keymap;
cairo_surface_t *img = NULL;
bool tile = false;
+bool ignore_empty_password = false;
/* isutf, u8_dec © 2005 Jeff Bezanson, public domain */
#define isutf(c) (((c) & 0xC0) != 0x80)
@@ -267,6 +268,10 @@ static void handle_key_press(xcb_key_press_event_t *event) {
case XKB_KEY_Return:
case XKB_KEY_KP_Enter:
case XKB_KEY_XF86ScreenSaver:
+ if (ignore_empty_password && input_position == 0) {
+ clear_input();
+ return;
+ }
password[input_position] = '\0';
unlock_state = STATE_KEY_PRESSED;
redraw_screen();
@@ -533,13 +538,14 @@ int main(int argc, char *argv[]) {
{"no-unlock-indicator", no_argument, NULL, 'u'},
{"image", required_argument, NULL, 'i'},
{"tiling", no_argument, NULL, 't'},
+ {"ignore-empty-password", no_argument, NULL, 'e'},
{NULL, no_argument, NULL, 0}
};
if ((username = getenv("USER")) == NULL)
errx(1, "USER environment variable not set, please set it.\n");
- while ((o = getopt_long(argc, argv, "hvnbdc:p:ui:t", longopts, &optind)) != -1) {
+ while ((o = getopt_long(argc, argv, "hvnbdc:p:ui:te", longopts, &optind)) != -1) {
switch (o) {
case 'v':
errx(EXIT_SUCCESS, "version " VERSION " © 2010-2012 Michael Stapelberg");
@@ -582,6 +588,9 @@ int main(int argc, char *argv[]) {
errx(1, "i3lock: Invalid pointer type given. Expected one of \"win\" or \"default\".\n");
}
break;
+ case 'e':
+ ignore_empty_password = true;
+ break;
case 0:
if (strcmp(longopts[optind].name, "debug") == 0)
debug_mode = true;