Repository navigation
Cap charging at 80% from the Power Panel #10431
Replies: 4 comments
|
Adding this thread here since it's related but nothing ever progressed with that so this should still be a valid request/discussion: #627 (comment) |
|
+1 for this. Hardware data point in case it helps whichever implementation lands:
|
|
If you want this before one of the PRs lands, I made Super Battery, a plugin that replaces the bar's battery popup with the same popup plus a Charge limit row. On laptops with It handles root differently from your design. The first time, a Set up button asks for your password through pkexec and installs one udev rule that gives your user's group write access to the charge limit files. After that the popup writes the threshold itself, with no prompt. It writes the limit again each time the shell starts, for firmware that forgets it on reboot. It also has low battery alerts (with your own sounds) and an auto power saver. Repo: https://github.com/Paul-Bob/omarchy-super-battery |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The power panel already reads charge-start-threshold and charge-end-threshold, and switches to "Charge limit / Holding" when a cap is active. There is no way to set one. Today that means editing sysfs by hand or installing TLP.
I added a CHARGE LIMIT section with two buttons, 80% and Full.
The part worth discussing is that nothing in the UI runs as root. The button writes a small config file, a systemd
.pathunit notices the change, and a privileged oneshot applies it tocharge_control_*. No polkit action, no password prompt, no setuid helper, and the panel never touches sysfs itself.Persistence needs hooks because the thresholds live in EC firmware rather than kernel memory: a udev rule for boot and hotplug, and the unit for resume. I also re-assert on a timer, which is belt and braces rather than something I can point at a specific failure for.
It has been running on my machine for a day. Happy to open a PR if there is interest, or to hear if you would rather solve the privilege hop a different way.
All reactions