Listen to keyboard events and mouse movements outside Electron

I get in several Electron projects, and I’m trying to understand how you could listen to any keystrokes or and track the path of the mouse when the application is running in the background. I use the menubar plugin, so the application is still running in the background.

I tried using the Globally Shortcut API, but it looks like these are only shortcuts and you cannot register individual keystrokes. I also looked through the API and have not yet found an event for keystrokes and mouse movements outside the main screen of the application.

+8
javascript javascript-events keyboard-events electron
source share
1 answer

This is outside the scope of ordinary use of the electronic application. To do this, you need to develop your own module that calls the corresponding native functions of the operating system.

For example, in windows: C ++ Win32 Keyboard Events

Creating custom add-ons for node: https://nodejs.org/api/addons.html

FYI, native add-ons are very heavy.

+3
source share

All Articles