Back to plugins
v1.0.1 Damian D'Souza
About
Battery Threshold Control
Control the battery charge threshold on laptop batteries to help extend overall battery lifespan. Someone would use this plugin to limit maximum charge levels while plugged in, reducing battery wear and heat.
Plugin
| Field | Value |
|---|---|
| ID | damian-ds7/battery-threshold |
| Entries | Bar widget: battery-threshold; panel: panel; service: service |
Requirements
- Laptop hardware supporting battery charge threshold control in sysfs
(
/sys/class/power_supply/*/charge_control_end_threshold). - The following external programs must be available on
PATH:test,sudo,bash,readlink,cat,getent,groupadd,usermod,udevadm,chgrp, andchmod.
Usage
- Bar Widget (
battery-threshold): Displays the current battery threshold in the bar. Click to toggle the panel. - Panel (
panel): Adjust the battery threshold using a slider (40–100%). Includes a Configure Permissions button if write access is missing. Toggle the panel using:
noctalia msg panel-toggle damian-ds7/battery-threshold:panel
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
battery_device |
folder |
/sys/class/power_supply/BAT0 |
Path to the battery sysfs directory. |
charge_threshold |
int |
80 |
Default charge threshold percentage (40–100%). |
IPC
# Set charge threshold percentage (between 40 and 100)
noctalia msg plugin damian-ds7/battery-threshold:service all set 80
# Trigger setup script for udev permissions
noctalia msg plugin damian-ds7/battery-threshold:service all setup
Notes
- Permissions & Setup: Requires write access to
/sys/class/power_supply/BAT0/charge_control_end_threshold. Automated setup creates thebattery_ctlgroup, adds the active user to it, and installs99-battery-threshold.rulesto/etc/udev/rules.d/. - Relogin / Reboot: A logout or system reboot is required after running
setup for
battery_ctlgroup membership changes to take effect. - Manual Setup Fallback: If Polkit is not available, run
sudo ./setup_rules.shmanually from the plugin directory. - Persistence: Threshold settings are stored in
threshold.txtin plugin data directory and restored across reboots.
Versions
| Version | Plugin API | Updated |
|---|---|---|
| v1.0.1 latest | 3 | Jul 28, 2026 |
Older versions stay installable on a Noctalia release whose plugin API is below the latest version's.