How to detect desktop idle time from an Electron app?

前端 未结 4 1039
情话喂你
情话喂你 2021-02-06 10:01

I need my Electron app to respond to the user becoming idle (no mouse or keyboard inputs to any program on the OS) for a certain amount of time.

How can I trigger a func

4条回答
  •  孤街浪徒
    2021-02-06 10:10

    Since electron uses node, you should checkout RobotJS. These things are platform specific so it does need some other dependancies but you can monitor mouse/keyboard and see if it's changed, or control it (hence the name).

提交回复
热议问题