Detect inactive users with the Idle Detection API | Capabilities | Chrome for Developers
The Idle Detection API notifies developers when a user is idle, indicating such things as lack of interaction with the keyboard, mouse, screen, activation of a screensaver, locking of the screen, or...