feat(battery-threshold): add multi-battery support and per-battery controls - #388
feat(battery-threshold): add multi-battery support and per-battery controls#388biplobsd wants to merge 2 commits into
Conversation
… and status tooltips
|
CC @damian-ds7 |
|
Sorry for the delay, a few notes:
|
|
And one more minor nitpick, I don't have any multibattery laptops so I simply not be aware of the use case, but is useful to be able to set batteries to different levels? Wouldn't it generally make sense to just set all of them to the same level? Is the option to set individually needed? It would probably simplify code quite a bit if there was a single threshold tracked at all times applied to all discovered (or explicitly given by the user) batteries |
|
Sorry for creating this PR directly without first opening an issue. I’ve removed all unnecessary code and only made modifications needed for multiple battery detections. Thanks for reviewing my code, and also for creating the plugin. Please check my changes again and let me know if there are any remaining issues or improvements needed. Since the battery feature is so critical, it requires careful review. |
|
Thanks, I will try to check out the changes before the weekend, sorry for the delay but I don't have too much free time right now |
Plugin
plugin.toml)What it does
Adds multi-battery support to
damian-ds7/battery-threshold(e.g. for ThinkPads and dual-battery laptops withBAT0andBAT1):/sys/class/power_supplythat exposecharge_control_end_threshold.set BAT1 80orset 80).thresholds.json(with backward-compatible fallback).External dependencies
The plugin shells out to standard Linux utilities listed in
dependenciesinplugin.toml:test: To verify write permissions on/sys/class/power_supply/*/charge_control_end_threshold.sudo,bash,readlink,cat,getent,groupadd,usermod,udevadm,chgrp,chmod: Insetup_rules.shto configure thebattery_ctludev rule and grant non-root write access.Testing
Screenshots / Videos
Tested on dual-battery laptop (ThinkPad with BAT0 and BAT1). Multi-battery panel controls and widget tooltips render and control each battery independently.


Checklist
idafter the/inplugin.tomlexactly.plugin.toml,README.md,thumbnail.webp, andtranslations/en.json.README.mdfollows the README template, documents every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.thumbnail.webpwith the thumbnail generator.versionfollows semver and is bumped in this PR;plugin_apiis the oldest API level this plugin requires.catalog.toml; CI generates it.Code review attestation
Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:
licensedeclared inplugin.toml.