From 06e06a1507143728cf3909a23191d423331e64a4 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sat, 16 Aug 2025 15:25:42 +0200 Subject: [PATCH] Support ^U for clearing password ^U is a fairly common key combo for clearing fields, this patch adds support for it. https://git.suckless.org/slock/commit/bf0a5577acbd9ec7c6a577601b97144b205840d7.html https://git.suckless.org/slock/commit/3791a996e230aec59d61faea46634ae4f031e359.html --- README.md | 4 ++-- slock.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2098565427c69c8b1cdf2828e4b013ebd1f03b3e..b3ce30b585536f191cd5231984e381245a5a6799 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this slock 1.6 (e3fb343, -2025-08-09) project has a different take on patching. It uses preprocessor directives to decide +Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this slock 1.6 (3791a99, +2025-08-16) project has a different take on patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. diff --git a/slock.c b/slock.c index 5711cfbcdb8e88987561e3ace58cc4371287c53e..d270f8c03a64ab1dc6dad5f74ce4fbc0e45a5c53 100644 --- a/slock.c +++ b/slock.c @@ -403,6 +403,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, { memcpy(passwd + len, buf, num); len += num; + } else if (buf[0] == '\025') { /* ctrl-u clears input */ + explicit_bzero(&passwd, sizeof(passwd)); + len = 0; } #if KEYPRESS_FEEDBACK_PATCH if (blocks_enabled)