Closed LucasColomer closed 1 year ago
Obviously only the event loop of focused window receives inputs from OS. So you need a hacky way to hook into global events, look into uiohook-napi package
Yes, clearly, I was wondering if it was possible to get the inputs directly from the C files and send them back to electron.
I've started looking at the uiohook-napi package and I'm going to continue on this path.
Thanks for the reply
The uiohook-napi work perfectly, thx for the work and have a good day !
Hello, I'm trying to create an overlay to track a user's actions.
I'm using the following code in the overlay html code to track mouse movements:
document.addEventListener('mousemove', (e) => { console.log(e); });
For the keyboard, I use the following code:
document.addEventListener('keydown', (e) => { console.log(e); });
When the overlay is not in focus, none of the codes work. By modifying the code a little, in particular by adding the
{ forward: true }
option in the code when calling the setIgnoreMouseEvents function, I get the mouse movement.However, for keyboard actions, if the overlay is not focused, I get no result.
Can anyone think of a way to retrieve keyboard inputs even if the overlay isn't focused?