How do I detect screen unlocked state using electron API?


I am working on an electron app(Mac). I need to detect when my screen gets locked and unlocked.

I am using powerMonitor API. It detects the screen locked state (suspend event).

But I am unable to detect when I screen gets unlocked.

The “resume” event defined in this api, gets triggered as soon as I click anywhere on the screen while the screen is locked, or I try to enter the password. But at this time, the screen is still locked.

Is there a way to detect when my screen gets unlocked ?

Help would be appreciated.


I’ve the same need : did you find a solution ?


Finding the solution +1