HASEL-UZH / PA.WindowsActivityTracker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idle state

bugii opened this issue · comments

The following electron API could be used to determine whether the user is even active. If not, write "Idle" in "activity" and "title" of the last entry.

https://www.electronjs.org/de/docs/latest/api/power-monitor#powermonitorgetsystemidlestateidlethreshold

For the Windows implementation, see here.

The following electron API could be used to determine whether the user is even active. If not, write "Idle" in "activity" and "title" of the last entry.

https://www.electronjs.org/de/docs/latest/api/power-monitor#powermonitorgetsystemidlestateidlethreshold

Note that a challenge with the above-mentioned approach is that the tracker is just TypeScript and currently has no ties to Electron. Since the powermonitor API is from Electron, it would lose that independence. (so far, our apps were always also using Electron, so it might not be a bad problem, especially, if we don't find a better solution)

Maybe there is also a simpler solution possible?

Like using a background thread that provides the number of seconds since the last activity from mouse or keyboard?
see, e.g., this simple code snippet or this Github project

Also, Chrome et al. might already support this natively through the Idle Detection API