Idle Detection API

Chrome’s Apps/Extensions API includes chrome.idle.* (docs) which allow querying and receiving notifications about the user degree of interaction with the device, categorized as “active”, “idle”, and “locked”. This is a feature used by chat apps to show some indicator of user activity/inactivity.

Several JS libraries have been created that distinguish active/idle within the context of a window (idle.ts, idle.js). These are necessarily limited to just watching for UI events, and can’t detect screen lock and other cases where the browser has more knowledge like activity in other tabs.

This seems like an API that would be useful for the browser to expose to script, modulo appropriate user permission. I’ve written up an Explainer which at this point just proposes adapting the extension API for the web practically as-is. It looks like Firefox and Edge also support this API for extensions, so browsers have some of the plumbing already.

Is there any other interest in such an API? Feedback here or in the repo would be appreciated.


We’d definitely be interested in this at Slack. Right now we use an Electron API to make this work, but it’d be great to avoid that and make this consistent across our web and Electron versions!

1 Like

We would be interested in this API for Google Chat. The API would be useful to decide which device to send notifications to based on a user’s idle state.

Chairs (@marcosc @cwilso @yoavweiss @travisleithead), can we get the repository above migrated into the WICG for further incubation of this proposal?


This API is now available as an Origin Trial in Chrome 84, which is the latest stable-channel release.

Sign up here to try it out:

Subscribe to updates on for news on the specification, which I am almost done with.

The Chrome Origin Trial for this API is wrapping up. Unfortunately we didn’t get participation from all the partners we wanted so we will be running a second Origin Trial which also includes the new permissions API and UX that is being added in Chrome 87. See the announcement here.

I’m planning to use this on my application to run background checks for a new version of my Angular app from my CD pipeline. Since this could consume some resources, will be better to check when the user is idle.

Hi, Renoir, former WebPlatform docs maintainer, it’s been a while, and I haven’t done anything here working on this WICG Discourse instance back in 2015.

My team at work has been looking at leveraging this API and we’re looking to find polyfills and d.ts typings. The API’s available in Chrome

Should anyone find and/or have written types and polyfill, that we didn’t find anywhere else yet (I’m still on the looking at web-platform-tests and other channels, and other W3C mailing list etc.). I’ll be on the look out and keep updated.