diff options
| author | Malfurious <m@lfurio.us> | 2021-10-03 22:49:39 -0400 |
|---|---|---|
| committer | Matt Hunter <m@lfurio.us> | 2026-01-17 17:10:07 -0500 |
| commit | 813a093e6c3c66b61020a4a855c83a236c4cdd7c (patch) | |
| tree | 5ad0d9cd934551c6e0f20a3e0dbc229aa6292a65 | |
| parent | d4d464a866115430418f066e1d66cb701018304e (diff) | |
| download | slock-813a093e6c3c66b61020a4a855c83a236c4cdd7c.tar.gz slock-813a093e6c3c66b61020a4a855c83a236c4cdd7c.zip | |
patch: control-clear
Adds an additional configuration parameter, controlkeyclear. When set to
1, slock will no longer change to the failure color if a control key is
pressed while the buffer is empty. This is useful if, for example, you
wake your monitor up by pressing a control key and don't want to spoil
the detection of failed unlocking attempts.
| -rw-r--r-- | config.def.h | 3 | ||||
| -rw-r--r-- | slock.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/config.def.h b/config.def.h index 83e4887..3639e91 100644 --- a/config.def.h +++ b/config.def.h @@ -11,3 +11,6 @@ static const char *colorname[NUMCOLS] = { /* treat a cleared input like a wrong password (color) */ static const int failonclear = 1; + +/* allow control key to trigger fail on clear */ +static const int controlkeyclear = 1; @@ -190,8 +190,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, caps = !caps; break; default: - if (num && !iscntrl((int)buf[0]) && - (len + num < sizeof(passwd))) { + if (controlkeyclear && iscntrl((int)buf[0])) + continue; + if (num && (len + num < sizeof(passwd))) { memcpy(passwd + len, buf, num); len += num; } |
