From 9fd0ec80741c514ca5f02b6ca9676a387d84313d Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 30 Jul 2014 13:02:56 -0700 Subject: [PATCH] disallow switching of VTs. --- slock.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/slock.c b/slock.c index 2649377..c43bb00 100644 --- a/slock.c +++ b/slock.c @@ -189,6 +189,22 @@ readpw(Display *dpy, const char *pws) if(len) --len; break; + case XK_Alt_L: + case XK_Alt_R: + case XK_Control_L: + case XK_Control_R: + case XK_F1: + case XK_F2: + case XK_F3: + case XK_F4: + case XK_F5: + case XK_F6: + case XK_F7: { + // Needs sudo privileges for systemctl + char *args[] = { "sudo", "systemctl", "poweroff", NULL }; + execvp("sudo", args); + // fall-through if we fail + } default: if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { memcpy(passwd + len, buf, num);