about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/event.c b/event.c
index 881d41a..c5e5f40 100644
--- a/event.c
+++ b/event.c
@@ -4,6 +4,7 @@
  */
 #include "dwm.h"
 #include <stdlib.h>
+#include <unistd.h>
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
 
@@ -360,6 +361,11 @@ grabkeys()
 	unsigned int i;
 	KeyCode code;
 
+	while(XGrabKeyboard(dpy, root, True, GrabModeAsync,
+			 GrabModeAsync, CurrentTime) != GrabSuccess)
+		usleep(1000);
+	XUngrabKeyboard(dpy, CurrentTime);
+
 	for(i = 0; i < len; i++) {
 		code = XKeysymToKeycode(dpy, key[i].keysym);
 		XGrabKey(dpy, code, key[i].mod, root, True,