sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

slock-terminalkeys-1.4.diff (973B)


      1 From 4b6b51100fa14256753f663c93daeb0f89f0a65a Mon Sep 17 00:00:00 2001
      2 From: Matthias Schoth <mschoth@gmail.com>
      3 Date: Fri, 15 May 2020 22:10:27 +0200
      4 Subject: [PATCH] Add key commands that are commonly used in terminal
      5  applications to slock.
      6 
      7 ---
      8  slock.c | 16 ++++++++++++++++
      9  1 file changed, 16 insertions(+)
     10 
     11 diff --git a/slock.c b/slock.c
     12 index d2f0886..bf1a392 100644
     13 --- a/slock.c
     14 +++ b/slock.c
     15 @@ -156,6 +156,22 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
     16  			    IsPFKey(ksym) ||
     17  			    IsPrivateKeypadKey(ksym))
     18  				continue;
     19 +			if (ev.xkey.state & ControlMask) {
     20 +				switch (ksym) {
     21 +				case XK_u:
     22 +					ksym = XK_Escape;
     23 +					break;
     24 +				case XK_m:
     25 +					ksym = XK_Return;
     26 +					break;
     27 +				case XK_j:
     28 +					ksym = XK_Return;
     29 +					break;
     30 +				case XK_h:
     31 +                                       ksym = XK_BackSpace;
     32 +					break;
     33 +				}
     34 +			}
     35  			switch (ksym) {
     36  			case XK_Return:
     37  				passwd[len] = '\0';
     38 -- 
     39 2.26.2
     40