diff --git a/awesome-menu.c b/awesome-menu.c index cd06bbbd0..465f98b48 100644 --- a/awesome-menu.c +++ b/awesome-menu.c @@ -620,8 +620,14 @@ main(int argc, char **argv) compute_match(); - if(XGrabKeyboard(disp, DefaultRootWindow(disp), True, - GrabModeAsync, GrabModeAsync, CurrentTime) != GrabSuccess) + for(opt = 1000; opt; opt--) + { + if(XGrabKeyboard(disp, DefaultRootWindow(disp), True, + GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) + break; + usleep(1000); + } + if(!opt) eprint("cannot grab keyboard"); redraw();