Listen for keyboard events and mouse movement outside of Electron app

前端 未结 1 406
故里飘歌
故里飘歌 2021-02-08 02:55

I\'ve been getting into a few Electron projects and I am trying to figure out how you could listen for any keypresses or and track mouse movement when the app is in the backgrou

1条回答
  •  Happy的楠姐
    2021-02-08 03:35

    This is outside of the realm of normal use-cases for an electron application. In order to do this you would need to develop a native module that calls into the corresponding native functions of the operating system.

    For example on windows: C++ Win32 keyboard events

    Making native addons for node: https://nodejs.org/api/addons.html

    FYI, Native addons are very hard.

    0 讨论(0)
提交回复
热议问题