Let the idle timings know whether you are plugged in
An idle screen costs a screen on wall power and the rest of your afternoon on battery, so they should not be the same number. hypridle has no concept of a power source -- one config, one set of timeouts -- so rather than maintaining two configs and swapping them, panama-idle builds the single config from whichever key set applies, and IdleLock rebuilds it when the charger comes or goes. That runs through the same 400ms debounce a settings change uses, so a loose charger cannot restart hypridle in a loop. The battery keys fall back to their AC counterparts rather than to the schema defaults. Without that, unplugging would silently override a deliberately long timing with a shipped short one, which is the kind of thing you would notice only by losing work. A machine with no battery reads none of it and generates exactly what it generated before. The contract pins that alongside the two obvious directions, and was checked by sabotaging the detection to confirm it fails rather than passing vacuously.
This commit is contained in:
@@ -90,9 +90,13 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
title: "Idle behavior"
|
||||
// Named for the power source only on a machine that has two of them.
|
||||
// On a desktop this is simply "Idle behavior", as it always was.
|
||||
title: Battery.available ? "Idle behavior on wall power" : "Idle behavior"
|
||||
subtitle: IdleLock.managed
|
||||
? "Idle timings are managed here. Changes take effect immediately."
|
||||
? (Battery.available && !Battery.acOnline
|
||||
? "Managed here. These apply when the charger is connected; the battery timings below are what is in effect right now."
|
||||
: "Idle timings are managed here. Changes take effect immediately.")
|
||||
: "hypridle is running its shipped configuration. Turn on management below to make these adjustable."
|
||||
|
||||
SliderRow { setting: "screenBlankMinutes"; zeroLabel: "Never" }
|
||||
@@ -101,6 +105,22 @@ SettingsPage {
|
||||
ToggleRow { setting: "lockOnSleep"; divider: false }
|
||||
}
|
||||
|
||||
// Absent on a desktop. hypridle holds one set of timeouts at a time, so
|
||||
// these do not layer on top of the card above -- they replace it whenever
|
||||
// the charger is unplugged, and panama-idle rebuilds the config at that
|
||||
// moment.
|
||||
SettingsCard {
|
||||
visible: Battery.available
|
||||
title: "Idle behavior on battery"
|
||||
subtitle: Battery.acOnline
|
||||
? "What will apply once the charger is unplugged."
|
||||
: "In effect right now."
|
||||
|
||||
SliderRow { setting: "screenBlankMinutesBattery"; zeroLabel: "Never" }
|
||||
SliderRow { setting: "lockMinutesBattery"; zeroLabel: "Never" }
|
||||
SliderRow { setting: "suspendMinutesBattery"; zeroLabel: "Never"; divider: false }
|
||||
}
|
||||
|
||||
// Only shown when the numbers are actually contradictory, rather than as a
|
||||
// permanent warning nobody reads.
|
||||
SettingsCard {
|
||||
|
||||
Reference in New Issue
Block a user