summaryrefslogtreecommitdiffstats
path: root/slock.c
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-10-03 22:49:39 -0400
committerMatt Hunter <m@lfurio.us>2026-01-17 17:10:07 -0500
commit813a093e6c3c66b61020a4a855c83a236c4cdd7c (patch)
tree5ad0d9cd934551c6e0f20a3e0dbc229aa6292a65 /slock.c
parentd4d464a866115430418f066e1d66cb701018304e (diff)
downloadslock-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.
Diffstat (limited to 'slock.c')
-rw-r--r--slock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/slock.c b/slock.c
index d7956b9..0dd4e2d 100644
--- a/slock.c
+++ b/slock.c
@@ -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;
}