From cea569bdb47eb0766624f9bebe5fff7e974c3cdc Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 6 Aug 2014 10:16:33 -0700 Subject: [PATCH] add proper def check. check all f keys. --- slock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/slock.c b/slock.c index fd4b00c..23d7dba 100644 --- a/slock.c +++ b/slock.c @@ -190,6 +190,7 @@ readpw(Display *dpy, const char *pws) if(len) --len; break; +#if SLOCK_SHUTDOWN case XK_Alt_L: case XK_Alt_R: case XK_Control_L: @@ -200,12 +201,19 @@ readpw(Display *dpy, const char *pws) case XK_F4: case XK_F5: case XK_F6: - case XK_F7: { + case XK_F7: + case XK_F8: + case XK_F9: + case XK_F10: + case XK_F11: + case XK_F12: + case XK_F13: { // Needs sudo privileges for systemctl char *args[] = { "sudo", "systemctl", "poweroff", NULL }; execvp("sudo", args); // fall-through if we fail } +#endif default: if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { memcpy(passwd + len, buf, num);