idle API
Hint
The idle API is inherited from Firefox, and its primary documentation is maintained by Mozilla at MDN. Thunderbird implements only the subset of functions, events, and types listed here. The MDN pages may provide further details and examples, but they may also reference features that are not supported in Thunderbird.
Use the browser.idle API to detect when the machine’s idle state changes.
Permissions
The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.
Hint
Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.
idle
Grant access to some or all methods of the idle API.
Functions
queryState(detectionIntervalInSeconds)
– [Added in TB 45]
Returns “idle” if the user has not generated any input for a specified number of seconds, or “active” otherwise.
Note
Before version 51, Thunderbird always reports ‘active’. After version 51, Thunderbird reports ‘active’ or ‘idle’ as appropriate.
Parameters
detectionIntervalInSeconds
The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.
Required permissions
setDetectionInterval(intervalInSeconds)
– [Added in TB 51]
Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.
Parameters
intervalInSeconds
Threshold, in seconds, used to determine when the system is in an idle state.
Required permissions
Events
onStateChanged
– [Added in TB 51]
Fired when the system changes to an active or idle state. The event fires with “idle” if the the user has not generated any input for a specified number of seconds, and “active” when the user generates input on an idle system.
Parameters for onStateChanged.addListener(listener)
listener(newState)
A function that will be called when this event occurs.
Required permissions
Types
IdleState
– [Added in TB 45]