Skip to main content

Module run_loop

Module run_loop 

Source

StructsΒ§

GuardOutcome πŸ”’
Result of evaluating the per-tick suppression guards: either no guard fires, or exactly one wins and dictates the tray icon (reason) plus whether the event-log records a GuardSuppress entry (log_as).

ConstantsΒ§

USER_IDLE_WARN_INTERVAL_SECS πŸ”’
Rate-limit window for repeated UserIdle::get_time failure warnings. One log line per 60 s is enough to surface a persistent platform-API breakage without spamming the log file once per tick.

StaticsΒ§

USER_IDLE_LAST_WARN_EPOCH πŸ”’
Epoch seconds (SystemTime::UNIX_EPOCH) at which the last UserIdle failure was logged; 0 means β€œnever warned yet” (also the at-rest value before the scheduler boots).

FunctionsΒ§

evaluate_guards πŸ”’
Pure decision: given the per-tick guard inputs, return which SuppressReason should fire (if any) and whether the run-loop should also write a GuardSuppress event for it.
log_suppressions πŸ”’
notify_break_coming πŸ”’
notify_screen_time_budget πŸ”’
now_epoch_secs_for_warn πŸ”’
Convert SystemTime::now() to seconds since the Unix epoch. Returns 0 if the system clock is somehow before 1970 β€” same fallback as the β€œnever warned” sentinel, which simply means the next warn fires.
process_match πŸ”’
run_loop πŸ”’
user_idle_warn_throttle πŸ”’
Decide whether enough time has elapsed since the last UserIdle warn to fire another one, and update the timestamp atomically if so.
warn_user_idle_failure πŸ”’
Surface a UserIdle::get_time error to the log, at most once per USER_IDLE_WARN_INTERVAL_SECS. Without this gate the production code silently fell back to β€œ0 = active” forever, so a broken platform call (X11 down, macOS API change, Wayland portal denied) would invisibly break idle suppression and screen-time tracking.