Skip to main content

Module inner

Module inner 

Source

Structsยง

Plan ๐Ÿ”’
The state changes a probe outcome implies. Returned by plan.
ProbeState ๐Ÿ”’

Enumsยง

HealthLog ๐Ÿ”’
A probe-health transition worth logging exactly once.
ProbeOutcome ๐Ÿ”’
What a single loginctl probe told us.

Constantsยง

FAILED_BACKOFF_MAX ๐Ÿ”’
HEALTHY_TTL ๐Ÿ”’

Staticsยง

STATE ๐Ÿ”’

Functionsยง

classify_loginctl ๐Ÿ”’
Classify one loginctl invocation. Ok(outcome) ends the probe; Err(detail) means โ€œthis candidate failed, try the nextโ€ and carries the failure detail โ€” including loginctlโ€™s stderr, which the old code dropped, so a bug report now pins the exact cause (#191). Pure over the raw output pieces so the success classification and stderr capture are testable without spawning loginctl.
healthy_plan ๐Ÿ”’
lock_state ๐Ÿ”’
parse_locked_hint ๐Ÿ”’
plan ๐Ÿ”’
Pure decision: from the prior (failure streak, already-logged) and a fresh probe outcome, compute the next state, the re-probe interval, and whether to emit a one-time health-transition log. Split out so the back-off growth and log-once behaviour are unit-testable without a real loginctl.
probe ๐Ÿ”’
probe_backoff_ttl ๐Ÿ”’
Re-probe interval after consecutive_failures failures. 0 (a healthy probe) uses HEALTHY_TTL; failures grow it exponentially from 30 s, capped at FAILED_BACKOFF_MAX, so a permanently-broken probe settles at one attempt every five minutes instead of every five seconds.
restored_if_was_disabled ๐Ÿ”’
screen_locked
session_candidates ๐Ÿ”’
Ordered loginctl show-session identifiers to try. The callerโ€™s own XDG_SESSION_ID is the most specific, but itโ€™s frequently unset for GUI apps launched detached from the logind session (D-Bus activation, some autostart paths) โ€” and there the old literal self fallback resolved to nothing, so loginctl exited non-zero and lock detection disabled itself (#191). auto is logindโ€™s lenient resolver โ€” the callerโ€™s session if it has one, otherwise the userโ€™s display session โ€” so it succeeds where self canโ€™t. Pure so the fallback order is testable without a logind session.