terminalkeys patch

- Apply terminalkeys patch
- Update README with link to terminalkeys patch
- Add diff to patches folder
This commit is contained in:
Sravan Balaji
2020-12-11 11:03:22 -05:00
parent f77748ad50
commit d617e8e10f
3 changed files with 57 additions and 0 deletions

View File

@@ -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

View File

@@ -0,0 +1,40 @@
From 4b6b51100fa14256753f663c93daeb0f89f0a65a Mon Sep 17 00:00:00 2001
From: Matthias Schoth <mschoth@gmail.com>
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

16
slock.c
View File

@@ -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: