Documentation
¶
Overview ¶
Package daemon runs lys-power: one idempotent, side-effecting evaluation of power source, profile and charge thresholds, driven by events rather than a polling loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run evaluates the policy until the context is canceled. It sleeps until something can change the outcome: an AC edge (UPower's OnBattery), a charge-to-full request (inotify on the runtime directory), the next time-based change Eval reports (a wall-clock timer that survives suspend and clock changes), or SIGHUP. Without a system bus it falls back to checking the power source every Tick; losing the bus ends it with an error.
Types ¶
type ProfileClient ¶
ProfileClient is the slice of power-profiles-daemon the manager needs. A nil client means profile handling is unavailable and is skipped.
type Result ¶
type Result struct {
OnAC bool
ProfileSet string
RecordedUnplug bool
ClearedFullNow bool
// Applied holds the thresholds written by this evaluation, nil when
// they were already in place or not managed.
Applied *supply.Thresholds
// Recheck is when the outcome next changes with the passage of time
// alone; zero means only an event can change it.
Recheck time.Time
}
Result reports what one evaluation observed and changed.
func Eval ¶
Eval performs one evaluation of the policy. It is idempotent: nothing at the wanted state is touched, including a profile the user picked by hand between AC edges.