kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.73k stars 344 forks source link

Wayland support #211

Open alexandru-crossover opened 6 years ago

alexandru-crossover commented 6 years ago

Hi @kwhat,

Now that Wayland is the default display server in Ubuntu, are there any plans to add support for Wayland in JNativeHook?

kwhat commented 6 years ago

Yes, I need to make xkbcommon a runtime dependency but it should be fairly easy. Which version of ubuntu contains wayland by default?

alexandru-crossover commented 6 years ago

Wayland is the default display server in Ubuntu 17.10. As far as I could tell, it is not clear currently if it will still be the default option in Ubuntu 18.04 LTS.

leandrocm86 commented 6 years ago

+1 for that. I'd like to consume (stop propagation) of events on Linux, and that seems to be impossible on X11, right? Maybe we could have that with Wayland.

kwhat commented 3 years ago

Sample implementation: https://github.com/Aishou/wayland-keylogger/blob/master/Keylogger.cpp

J0B10 commented 3 years ago

Maybe this project could also be a good inspiration:
https://github.com/snyball/Hawck

It works by putting a deamon between physical keyboard and virtual keyboard.
That method would defiantly allow to consume key events and would be independent of Window Manager / Desktop Environment.

I don't know if this technique could be adapted for JNativeHook. But maybe it could be usefull.

darrencocco commented 2 years ago

+1 also standard on Fedora 35/36 IIRC correctly. (I'm using Wayland myself on F36 if you need a tester)

lov3b commented 1 year ago

Hi! How's the progress on the wayland implementation?

kwhat commented 1 year ago

It is in progress here. It is going to take some time and I am not sure this will work but it shows some promise right now. I currently have a bunch of changes locally to cleanup the PoC code that is currently there but it doesn't work yet. Updates are tracked against this issue.

kwhat commented 8 months ago

Just and update. Evdev support is mostly working upstream. Consuming keys appears to work correctly, mouse motion and wheel events maybe more of an issue. The last major hurdle will be the system_properties because there doesn't appear to be a generic way of doing a lot of this outside of X11. Getting things like the mouse sensitivity, double click speed and monitor count and resolution are all going to be a pain if not impossible under Wayland.