Skip to main content

resolve_idle_secs

Function resolve_idle_secs 

Source
fn resolve_idle_secs(
    backoff: &mut IdleProbeBackoff,
    probe: impl FnOnce() -> Result<u64, String>,
) -> Option<u64>
Expand description

Resolve this tick’s raw idle seconds, driving the probe back-off. probe performs the platform UserIdle call, yielding the idle seconds on success or a display-error string on failure. The back-off state and the throttled warning are handled here; the only thing the caller keeps platform-bound is probe itself, so this decision logic is unit-testable without a windowing system.

A failed or skipped (in-cooldown) probe reports None — idle is unknown this tick. Callers map that to 0 (“active”) for screen-time and idle-suppression (the conservative default that never silently suppresses a break), but the typing-defer path treats None as “can’t tell” and fires rather than stalling every break for the cap (#67).