Repository navigation
Conversation
Contributor
|
I have a Lenovo LOQ where Conservation Mode works by writing |
dkalinkov
force-pushed
the
battery-conservation-toggle
branch
from
November 9, 2026 07:47
e624350 to
99b9034
Compare
dkalinkov
marked this pull request as ready for review
November 9, 2026 19:09
Contributor
[Medium impact] The PR appears safe to merge. SummaryAdds a UPower-backed charge-limit command and power-panel switch.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Charge limit to the power panel when UPower reports support. Turning it on applies the hardware's battery protection policy; turning it off permits a full charge.
The compact row shows the available policy: “Maximum 80%”, “Start below 75% · stop at 80%”, or “Device default” for firmware-controlled protection. The caption stays in place when switching on/off. Up/Down moves between profiles and the charge limit, Left/Right selects off/on, and Enter/Space toggles. The switch keeps its keyboard focus during writes and refreshes.
Behavior
omarchy battery charge-limit [status|on|off|toggle] [--shell]discovers present system batteries using typed UPower properties. Peripherals, UPS devices, absent batteries and unsupported batteries are excluded. The control is hidden when unsupported. Mixed settings are shown explicitly; toggling a mixed state enables all supported batteries.EnableChargeThresholdwith an explicit state, skip batteries already in that state, and verify readback before reporting success. Refused or ignored changes fail. Partial changes are not rolled back; the panel reads and displays the resulting state.UPower owns hardware access, authorization and persistence. There are no vendor-specific paths, direct sysfs writes, sudoers rules or privileged background service.
Verification
git diff --checkpass. CLI routing/metadata and Bash syntax checks passed in the preceding backend revision; this revision changes panel interaction, copy and documentation.Related work
This overlaps #8579, #13205, #15431 and #16516. Policy explanations draw on #8579, percentage/firmware capability handling follows the direction of #15431, and tested keyboard selection follows the approach discussed in #16516. These are design references; their commits have not been incorporated.
This proposal combines those ideas with per-battery policy reconciliation, verified writes, explicit mixed state, read-failure recovery and change-driven refresh. The core feature and UPower approach are shared; maintainers should coordinate the proposals.
Screenshots
Before

After — charge limit off

After — charge limit on

Keyboard interaction
https://github.com/user-attachments/assets/befc9f7f-9663-4bdf-b533-4d7fec11283f
Start/stop thresholds — test fixture

Settings unavailable — test fixture
