diff --git a/README.md b/README.md index 7a566af..73c85b1 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,4 @@ Most patches can be found on the suckless website: [https://tools.suckless.org/s * [capscolor](https://tools.suckless.org/slock/patches/capscolor/) - Introduces an additional color to indicate the state of Caps Lock. * [mediakeys](https://tools.suckless.org/slock/patches/mediakeys/) - Allows use of media keys while screen is locked * [message](https://tools.suckless.org/slock/patches/message/) - This patch lets you add a message to your lock screen. You can place a default message in `config.h`, and you can also pass a message with `-m message` +* [terminalkeys](https://tools.suckless.org/slock/patches/terminalkeys/) - Add key commands that are commonly used in terminal applications (in particular the login prompt) to slock diff --git a/patches/slock-terminalkeys-1.4.diff b/patches/slock-terminalkeys-1.4.diff new file mode 100644 index 0000000..c8d0a45 --- /dev/null +++ b/patches/slock-terminalkeys-1.4.diff @@ -0,0 +1,40 @@ +From 4b6b51100fa14256753f663c93daeb0f89f0a65a Mon Sep 17 00:00:00 2001 +From: Matthias Schoth +Date: Fri, 15 May 2020 22:10:27 +0200 +Subject: [PATCH] Add key commands that are commonly used in terminal + applications to slock. + +--- + slock.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/slock.c b/slock.c +index d2f0886..bf1a392 100644 +--- a/slock.c ++++ b/slock.c +@@ -156,6 +156,22 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, + IsPFKey(ksym) || + IsPrivateKeypadKey(ksym)) + continue; ++ if (ev.xkey.state & ControlMask) { ++ switch (ksym) { ++ case XK_u: ++ ksym = XK_Escape; ++ break; ++ case XK_m: ++ ksym = XK_Return; ++ break; ++ case XK_j: ++ ksym = XK_Return; ++ break; ++ case XK_h: ++ ksym = XK_BackSpace; ++ break; ++ } ++ } + switch (ksym) { + case XK_Return: + passwd[len] = '\0'; +-- +2.26.2 + diff --git a/slock.c b/slock.c index a21968d..0760d40 100644 --- a/slock.c +++ b/slock.c @@ -259,6 +259,22 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, IsPFKey(ksym) || IsPrivateKeypadKey(ksym)) continue; + if (ev.xkey.state & ControlMask) { + switch (ksym) { + case XK_u: + ksym = XK_Escape; + break; + case XK_m: + ksym = XK_Return; + break; + case XK_j: + ksym = XK_Return; + break; + case XK_h: + ksym = XK_BackSpace; + break; + } + } switch (ksym) { case XF86XK_AudioPlay: case XF86XK_AudioStop: