summaryrefslogtreecommitdiffstats
path: root/slock.c
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-10-03 22:49:39 -0400
committerMalfurious <m@lfurio.us>2023-06-01 21:24:09 -0400
commit80ba53531670f06b82a6592e878ed7e7a802b4e6 (patch)
tree79ec69ea3645c0123de1afcff25248b405cafb30 /slock.c
parent505fe537796a38ea4a7023df0d938c0a2a43cc64 (diff)
downloadslock-80ba53531670f06b82a6592e878ed7e7a802b4e6.tar.gz
slock-80ba53531670f06b82a6592e878ed7e7a802b4e6.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 5f4fb7a..fa21209 100644
--- a/slock.c
+++ b/slock.c
@@ -189,8 +189,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;
}