Skip to main content

Module session_lock

Module session_lock 

Source
Expand description

Cross-platform “is the user session locked?” probe.

HIDIdleTime (and its X11/Windows analogues, which user_idle wraps) only knows about input events. A stray caffeinate -u, a Zoom meeting holding UserIsActive, a debugger posting synthetic CGEventPost clicks, or a window-jiggler utility all keep the HID idle clock at zero while the human is gone. The lock screen is a stronger signal — short of unlocking it, the user is by definition away — so the scheduler layers this check on top of HID idle.

Each backend returns Option<bool>:

  • Some(true) — confidently locked
  • Some(false) — confidently unlocked
  • None — couldn’t determine (no GUI session, API unavailable, helper binary missing)

Callers treat None as “trust HID idle alone”; the scheduler only promotes idleness when we get a definitive Some(true).

Modules§

inner 🔒

Functions§

screen_locked