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:
Gabriel Brown
2026-08-21 22:18:29 -04:00
parent 3c359f3f7e
commit bc6d63b70f
8 changed files with 187 additions and 8 deletions
+11 -1
View File
@@ -4,7 +4,7 @@
Do not edit this file. Run `quickshell/scripts/panama-settings-docs`
after changing the schema; a contract fails when this copy is stale.
143 settings across 28 groups. 70 of them are applied to the compositor and confirmed by reading the value back.
146 settings across 29 groups. 70 of them are applied to the compositor and confirmed by reading the value back.
## accessibility
@@ -143,6 +143,16 @@ Found on **Power & Lock**.
| **Suspend after**<br>`suspendMinutes` | 0 min | This is a desktop, so Panama ships with automatic suspend off. Range 0480. |
| **Lock before sleeping**<br>`lockOnSleep` | true | Requires your password when the machine wakes |
## idleBattery
Found on **Power & Lock**.
| Setting | Default | What it does |
|---|---|---|
| **Turn the screen off after**<br>`screenBlankMinutesBattery` | 2 min | On battery. Blanks the display; nothing is locked yet. Range 0120. |
| **Lock after**<br>`lockMinutesBattery` | 5 min | On battery. Requires your password to get back in. Range 0240. |
| **Suspend after**<br>`suspendMinutesBattery` | 20 min | On battery, sleeping is what makes the charge last. Range 0480. |
## input
Found on **Keyboard**.