media keys patch

This commit is contained in:
Jakub 2023-01-02 23:18:01 -05:00
parent 083ec4908f
commit 23f5f0a529
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,31 @@
diff --git a/slock.c b/slock.c
index 5ae738c..bd54be2 100644
--- a/slock.c
+++ b/slock.c
@@ -18,6 +18,7 @@
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/XF86keysym.h>
#include "arg.h"
#include "util.h"
@@ -157,6 +158,18 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
IsPrivateKeypadKey(ksym))
continue;
switch (ksym) {
+ case XF86XK_AudioPlay:
+ case XF86XK_AudioStop:
+ case XF86XK_AudioPrev:
+ case XF86XK_AudioNext:
+ case XF86XK_AudioRaiseVolume:
+ case XF86XK_AudioLowerVolume:
+ case XF86XK_AudioMute:
+ case XF86XK_AudioMicMute:
+ case XF86XK_MonBrightnessDown:
+ case XF86XK_MonBrightnessUp:
+ XSendEvent(dpy, DefaultRootWindow(dpy), True, KeyPressMask, &ev);
+ break;
case XK_Return:
passwd[len] = '\0';
errno = 0;

13
slock.c
View File

@ -22,6 +22,7 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/XF86keysym.h>
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <Imlib2.h> #include <Imlib2.h>
@ -200,6 +201,18 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
IsPrivateKeypadKey(ksym)) IsPrivateKeypadKey(ksym))
continue; continue;
switch (ksym) { switch (ksym) {
case XF86XK_AudioPlay:
case XF86XK_AudioStop:
case XF86XK_AudioPrev:
case XF86XK_AudioNext:
case XF86XK_AudioRaiseVolume:
case XF86XK_AudioLowerVolume:
case XF86XK_AudioMute:
case XF86XK_AudioMicMute:
case XF86XK_MonBrightnessDown:
case XF86XK_MonBrightnessUp:
XSendEvent(dpy, DefaultRootWindow(dpy), True, KeyPressMask, &ev);
break;
case XK_Return: case XK_Return:
passwd[len] = '\0'; passwd[len] = '\0';
errno = 0; errno = 0;