Battery Health Charging extension sets the limit of battery charging to maximize battery health mainly for laptops that support these features. Since users usually keep their AC adapter connected while using their laptop, the battery is often in a state of high-power (98-100%) for an extended length of time which causes a reduction in battery life. Initially, I made this for my laptop (Asus) but as of Version 4 , the extension evolve to support several brands. Some laptops have fixed threshold, while some laptop's threshold can be customized. (See details in laptop supported). This extension detects the hardware and displays the option accordingly.
1. Full Capacity Mode: Battery is charged to its full capacity for longer use on battery power.(Threshold are customizable on some laptop.)
2. Balanced Mode: Stops charging when power is above 80% and resumes charging when power is below 75%. This mode is recommended when using the Notebook on battery power during meetings or conferences. (Threshold are customizable on some laptop. Some laptop don't feature this option.)
3. Maximum Lifespan Mode: Stops charging when power is above 60% and resumes charging when power is below 55%. This mode is recommended when the Notebook is always powered by AC adapter.(Threshold are customizable on some laptop. Some laptop the maximum lifespan mode is set to 80%)
Asus
LG
Samsung
Sony
Huawei
Toshiba
System76
Lenovo (Ideapad, Legion)
Thinkpad
Thinkpad (legacy tpsmapi)
Panasonic
Acer
MSI
Intel QC71 (XMG, Eluktronics, Tuxedo)
Tuxedo
Gigabyte (Aero, Aorus)
Dell (libsmbios)
Dell (Dell command configure cctk)
Apple Macbook Intel-series chip
Apple Macbook M-series chipChangelogs
Polkit Installation
Translation
Bug / Issues /Feature Request
Credits and Reference
-
Conflicts with other battery charging threshold controls apps / extensions / local workarounds scripts, so better to disable or remove before using this extension.
-
The charging mode persists on reboot. As of Version 4 if your device needs privileged access (root) to change the threshold, this extension will prompt you to install polkit script. This way the extension can change the threshold on users input and also restore it on system restarts.
-
Customize threshold (only for device that support custom threshold)
-
Extension Pref icon in quick settings menu. And added option in preference to remove this icon from quick setting.
-
Option to choose 3 set of icons in preference.
-
Shows an icon indicating current mode. And added option in preference to change index and also to disable showing icon
-
Option to change behavior of systems battery indicator. When charging threshold is set and battery level reaches threshold, the default behavior in gnome is system battery indicator will display On battery - charger unplugged/powered-off icon and there is no way of knowing if charger is plugged and powered. Upon enabling this option, system battery indicator will display charging icon. Note: If this feature is not working for your laptop, kindly raise an issue with your and post the results of power supply name with the following command in terminal
ls -l /sys/class/power_supply
-
Displays notification when threshold/mode is changed. And added option in preference to disable notification update
-
Display current mode subtitles in quicksetting toggle (Gnome 44 and above). And added an option in preference to remove this subtitle.
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default threshold values of these 3 preset modes are set at 100%, 80%, and 60%.
- Each preset threshold value can be customized between 100-80 %, 85-65 %, and 85-50 % respectively.
- This Extension supports Asus Laptop having one of the below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
'/sys/class/power_supply/BAT1/charge_control_end_threshold'
'/sys/class/power_supply/BATC/charge_control_end_threshold'
'/sys/class/power_supply/BATT/charge_control_end_threshold'
- 2 preset Full capacity and Maximum Life Span mode set at 100% and 80%. Fixed threshold (not customizable).
- This Extension supports LG laptops having the below path.
'/sys/devices/platform/lg-laptop/battery_care_limit'
- 2 preset Full capacity and Maximum Life Span mode set at 100% and 80%(85% in some model). Fixed threshold (not customizable).
- Maximum Life Span mode is the what Samsung refers to as smart charging mode
- This Extension supports Samsung laptops having the below path.
'/sys/devices/platform/samsung/battery_life_extender'
- 3 preset Full capacity, Balanced and Maximum Life Span mode set at 100%, 80% and 50%. Fixed threshold (not customizable).
- Balanced mode is what Sony refers to as Battery care function 80%
- Maximum Life Span mode is what Sony refers to as Battery care function 50%
- This Extension supports Sony laptops having the below path.
'/sys/devices/platform/sony-laptop/battery_care_limiter'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default end/start threshold values of these 3 preset modes are set at 100/95%, 80/75%, and 60/55%.
- Each preset end threshold value can be customized between 100-80 %, 80-65 %, and 85-50 % respectively.
- Each preset start threshold value can be customized between is 98-75 %, 83-60 %, and 83-40 % respectively.
- The difference between end and start threshold cannot be less than 2%.
- This Extension supports Huawei laptops having the below path.
'/sys/devices/platform/huawei-wmi/charge_thresholds'
- 2 preset Full capacity and Maximum Life Span mode set at 100% and 80%. Fixed threshold (not customizable).
- Maximum Life Span mode is what Toshiba refers to as eco charging mode
- This Extension supports Toshiba laptops having one of the below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
'/sys/class/power_supply/BAT1/charge_control_end_threshold'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default end/start threshold values of these 3 preset modes are set at 100/95%, 80/75%, and 60/55%.
- Each preset end threshold value can be customized between 100-80 %, 85-65 %, and 85-50 % respectively.
- Each preset start threshold value can be customized between is 98-75 %, 83-60 %, and 83-40 % respectively.
- The difference between end and start threshold cannot be less than 2%.
- This Extension supports System76 laptops having the below path.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
'/sys/class/power_supply/BAT0/charge_control_start_threshold'
- 2 preset Full capacity and Maximum Life Span mode set at 100% and 60%(80% in some model). Fixed threshold (not customizable).
- Maximum Life Span mode is what Lenovo refers to as conservative mode
- This Extension supports Lenovo Ideapad Laptop having the below path
'/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default end/start threshold values of these 3 preset modes are set at 100/95%, 80/75%, and 60/55%.
- Each preset end threshold value can be customized between 100-80 %, 80-65 %, and 85-50 % respectively.
- Each preset start threshold value can be customized between is 98-75 %, 83-60 %, and 83-40 % respectively.
- The difference between end and start threshold cannot be less than 2%.
- This Extension supports Thinkpad laptops that have pair of below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
'/sys/class/power_supply/BAT0/charge_control_start_threshold'
'/sys/class/power_supply/BAT1/charge_control_end_threshold'
'/sys/class/power_supply/BAT1/charge_control_start_threshold'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default end/start threshold values of these 3 preset modes are set at 100/95%, 80/75%, and 60/55%.
- Each preset end threshold value can be customized between 100-80 %, 80-65 %, and 85-50 % respectively.
- Each preset start threshold value can be customized between is 95-75 %, 85-60 %, and 85-40 % respectively.
- The difference between end and start threshold cannot be less than 5%.
- This Extension supports Thinkpad laptops that have pair of below paths.
'/sys/devices/platform/smapi/BAT0/stop_charge_thresh'
'/sys/devices/platform/smapi/BAT0/start_charge_thresh'
'/sys/devices/platform/smapi/BAT1/stop_charge_thresh'
'/sys/devices/platform/smapi/BAT1/start_charge_thresh'
- 2 preset Full capacity and Maximum Life Span mode set at 100% and 80%(75% in some model). Fixed threshold (not customizable).
- This Extension supports Panasonic laptops having the below path.
'/sys/devices/platform/panasonic/eco_mode'
- 2 preset Full capacity and Maximum Life Span modes set at 100% and 80%. Fixed threshold (not customizable).
- Maximum Life Span mode is the what Acer refers to as Battery Limit charge
- Depends on separate kernel module (dkms) installation https://github.com/frederik-h/acer-wmi-battery (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs or damages)
- This Extension supports Acer laptops having the below path.
'/sys/bus/wmi/drivers/acer-wmi-battery/health_mode'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default threshold values of these 3 preset modes are set at 100%, 80%, and 60%.
- Each preset threshold value can be customized between 100-80 %, 85-65 %, and 85-50 % respectively.
- Full capacity mode is equivalent to what Msi refers to as Best for Mobility
- Balanced mode is equivalent to what Msi refers to as Balance
- Maximum Life Span mode is equivalent to what Msi refers to as Best for Battery
- Depends on separate kernel module (dkms) installation https://github.com/BeardOverflow/msi-ec (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs, or damages) Although the module has been submitted lately into the mainline kernel and may not be needed.
- This Extension supports MSI laptops having one of the below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default threshold values of these 3 preset modes are set at 100%, 80%, and 60%.
- Each preset threshold value can be customized between 100-80 %, 85-65 %, and 85-50 % respectively.
- Depends on separate kernel module (dkms) installation https://github.com/pobrn/qc71_laptop (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs, or damages)
- Support some model from XMG, Eluktronics, Tuxedo, etc using kernel module.
- This Extension supports qc71 laptops which have the below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
- 2/3 preset Full capacity, Balanced and Maximum Life Span mode set at 100%, 90% and 80%. Fixed threshold (not customizable).
- Maximum Life Span mode is what Sony refers to as Stationary
- Depends on separate kernel module (dkms) installation https://github.com/tuxedocomputers/tuxedo-keyboard (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs, or damages)
- This Extension supports Tuxedo laptops having the below path.
'/sys/devices/platform/tuxedo_keyboard/charging_profile/charging_profiles_available'
'/sys/devices/platform/tuxedo_keyboard/charging_profile/charging_profile'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default threshold values of these 3 preset modes are set at 100%, 80%, and 60%.
- Each preset threshold value can be customized between 100-80 %, 85-65 %, and 85-60 % respectively.
- Depends on separate kernel module (dkms) installation https://github.com/tangalbert919/gigabyte-laptop-wmi (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs, or damages)
- Support some model from Aero, Aorus etc using kernel module.
- This Extension supports gigabyte laptops which have the below paths.
'/sys/devices/platform/gigabyte_laptop/charge_mode'
'/sys/devices/platform/gigabyte_laptop/charge_limit'
NOTE: The Express mode may cause battery health to diminish more quickly than other modes.
- 5 presets Express, Adaptive, Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Express and Adaptive are fixed mode. You can find the description of Express charge mode and adaptive mode on dell website.
- Full Capacity Mode, Balance Mode, and Maximum Life Span mode are custom mode with end/start threshold values set to 100/95%, 80/75%, and 60/55%.
- Each custom mode preset end threshold value can customize between 100-80 %, 85-65 %, and 85-55 % respectively.
- Each custom mode preset start threshold value can customize between 95-75 %, 83-60 %, and 83-50 % respectively.
- Full capacity mode is equivalent to what Dell refers to as Standard
- Balance mode is almost equivalent to what Dell refers to as Primarily AC
- The difference between end and start threshold cannot be less than 5%.
- Depends on executable package smbios-battery-ctl which is provided by smbios-utils https://github.com/dell/libsmbios (smbios-utils is third-party package and I am not in any way not responsible for installation, bugs, or damages)
- This Extension supports dell through smbios-utils package smbios-battery-ctl using following commands
smbios-battery-ctl --set-charging-mode express
smbios-battery-ctl --set-charging-mode adaptive
smbios-battery-ctl --set-charging-mode custom
smbios-battery-ctl --set-custom-charge-interval low high
NOTE: The Express mode may cause battery health to diminish more quickly than other modes. NOTE: Doesnt support changing threshold with bios password
- 5 presets Express, Adaptive, Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Express and Adaptive are fixed mode. You can find the description of Express charge mode and adaptive mode on dell website.
- Full Capacity Mode, Balance Mode, and Maximum Life Span mode are custom mode with end/start threshold values set to 100/95%, 80/75%, and 60/55%.
- Each custom mode preset end threshold value can customize between 100-80 %, 85-65 %, and 85-55 % respectively.
- Each custom mode preset start threshold value can customize between 95-75 %, 83-60 %, and 83-50 % respectively.
- Full capacity mode is equivalent to what Dell refers to as Standard
- Balance mode is almost equivalent to what Dell refers to as Primarily AC
- The difference between end and start threshold cannot be less than 5%.
- Depends on executable package cctk provided by dell command configure (Dell command configure is third-party package and I am not in any way not responsible for installation, bugs, or damages)
- This Extension supports dell through smbios-utils package smbios-battery-ctl using following commands
/opt/dell/dcc/cctk --PrimaryBattChargeCfg=Express
/opt/dell/dcc/cctk --PrimaryBattChargeCfg=Adaptive
/opt/dell/dcc/cctk --PrimaryBattChargeCfg=Custom:low-high
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default threshold values of these 3 preset modes are set at 100%, 80%, and 60%.
- Each preset threshold value can be customized between 100-80 %, 85-65 %, and 85-50 % respectively.
- Depends on separate kernel module (dkms) installation https://github.com/c---/applesmc-next (This kernel module is supported by a third party and I am not in any way not responsible for the kernel module installation, bugs, or damages)
- This Extension supports Apple laptops having one of the below paths.
'/sys/class/power_supply/BAT0/charge_control_end_threshold'
- 3 presets Full Capacity Mode, Balance Mode, and Maximum Life Span mode.
- Default end/start threshold values of these 3 preset modes are set at 100/95%, 80/75%, and 60/55%.
- Each preset end threshold value can be customized between 100-80 %, 85-65 %, and 85-52 % respectively.
- Each preset start threshold value can be customized between is 98-75 %, 83-60 %, and 83-50 % respectively.
- The difference between end and start threshold cannot be less than 2%.
- This Extension supports Macbooks using Asahi Linux having the below path.
'/sys/class/power_supply/macsmc-battery/charge_control_end_threshold'
'/sys/class/power_supply/macsmc-battery/charge_control_start_threshold'
May 22, 2023
- German translation update (Thanks olebole)
- Fix for some thinkpad mode conditions where start threshold should be less than end threshold. (Thanks olebole)
- Adjusted allowed custom valueLegacy thinkpad (tpsmapi) as allowed values for end endthreshold > startthreshold + 5
May 18, 2023
- Turkish translation update (Thanks sabriunal)
- Used CHECK Icons (Same as wifi) for displaying selected mode, instead of ugly CHECK ornament unicode.
- Removed threshold value displayed on panel/notification for lenovo ideapad/legion. When charging limit is enabled (conservation mode), Some models sets threshold to 60% and some models set threhsold to 80%, and the kernel doesnt report what is the current threshold value is, but only informs that charging limit is enabled or disabled. Now it will report only the current mode. conservation mode enabled displays max lifespan mode. conservation mode disable display full capacity mode.
- Removed threshold value displayed on panel/notification for Samsung laptop. When charging limit is enabled (battery_life_extender), Some models sets threshold to 60% and some models set threhsold to 80%, and the kernel doesnt report what is the current threshold value is, but only informs that charging limit is enabled or disabled. Now it will report only the current mode. battery_life_extender mode enabled, displays max lifespan mode. battery_life_extender mode disable, display full capacity mode.
- Same goes for panasonic
May 12, 2023
- Dutch translation update (Thanks Vistaus)
See Full History
- All devices require privileged permission (root) to change threshold/mode. Therefore the extension will notify the user to install polkit from extension settings. Installing polkit will require privileged (root) access and will need to logout and re-login.
- During the extension update, if the polkit/ctl file have change and updated, a extension with notify you to update the polkit.
- Please remove/uninstall polkit first using this extension preferences, prior to uninstalling this extension
Please contribute translation. Using Poedit / Gtranslator (Available in gnome software). Using poedit Open/create your language.po. Download the po/Battery-Health-Charging.pot file from github. Go to Translation and Update from POT file , translate and submit a pull-request to the main branch on github. Or raise an issue and I will upload it manaully.
Please raise an issue on github.
If the extension is working well for you, Please take the time to submit a review mentioning the brand/model of your laptop. https://extensions.gnome.org/extension/5724/battery-health-charging/
I made this extension for my Asus Viwobook. I have looked into codes of other extensions to create this extension. Credits to them.
Thinkpad Battery Threshold -by marcosdalvarez https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension
Supergfxctl (Super Graphics Control) - Asus-linux https://gitlab.com/asus-linux/supergfxctl
Shutdown Timer - by Deminder https://github.com/Deminder/ShutdownTimer For polkit resources.
Battery Indicator Icon - by Deminder https://github.com/Deminder/battery-indicator-icon
BlurMyshell - by Aunetx https://github.com/aunetx/blur-my-shell
Dash-to-Dock - by micheleg https://github.com/micheleg/dash-to-dock
Caffeine - by eon https://github.com/eonpatapon/gnome-shell-extension-caffeine
More info about battery life on asus official site https://www.asus.com/support/FAQ/1032726/
TLP - by linrunner https://github.com/linrunner/TLP For lot of resources about battery threshold.
Arch-Linux https://wiki.archlinux.org/title/Category:Laptops
Gnome guides https://gjs.guide/extensions/development/creating.html
Just Perfection Videos and examples https://gitlab.com/justperfection.channel/how-to-create-a-gnome-extension-documentation/-/tree/master/Examples
Also Thanks for support: Just Perfection. Andy Holmes, mascherm, kir-93, monethass, anzigo, asant, yukina3230, Valeria, albanobattistella, teohhanhui, ai, ViBE-HU, tangalbert919, r_wraith, AbrarSL, viksok, Vistaus, sabriunal, olebole