-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async GrabKey #120
Comments
could you post more code? |
Sorry, should have done it in the first message
|
I'm not sure that just by grabbing keyboard you are selection corresponding event mask. Try to add ChangeAttribute on root window with corresponding key event mask. ( I'll post code once I have example working ) |
X.GrabKey is supposed to take 0 for GrabModeSync and 1 for GrabModeAsync, not false and true. |
Well, looks like Buffer converts false to 0 and true to 1, so that is not the issue. |
@ewnd9 this code works for me ( I have 57 as key code for space ) var x11 = require('./');
x11.createClient(function(error, display) {
var X = display.client;
var root = display.screen[0].root;
var space = 57;
var pointerMode = false;
var keyboardMode = true;
X.GrabKey(root, 0, 0, space, pointerMode, keyboardMode);
X.ChangeWindowAttributes(root, { eventMask: x11.eventMask.KeyPress });
}).on('event', function(event) {
console.log(event);
}); |
No luck for me |
how do you test it? Do you get events printed when focus is on root window? I used Xephyr for test to avoid interaction with window manager |
I ran directly in terminal, events are always printed. Example: I start script and when I print in browser / other terminal sequence "a" "space" "b" I get "ab" in input |
this seems like how it should work: because you grabbed space it was routed to root window instead of browser |
So, it is not possible to propagate events from cli? I'm trying to archive global keybindings for cli apps |
I am trying something like
X.GrabKey(root, 0, 0, 65, false, true);
to capture space keypresses. How can I propagate keypress event to all system? Right now script is blocking space key, so the system doesn't see it.The text was updated successfully, but these errors were encountered: