I don’t know how this Gnome feature works, but on the Thinkpad T series, I have always just modified the charge thresholds directly via /sys. This is written to the battery controller and applies across OSs (I have done it in Linux in the past and it applied to the dual-boot Windows, too):
~ ❯ echo 35 | sudo tee /sys/class/power_supply/BAT0/charge_control_start_threshold
~ ❯ echo 85 | sudo tee /sys/class/power_supply/BAT0/charge_control_end_threshold
According to this page, this should also work for the Thinkpad X230. Maybe it will work on your X270, too, and not be overridden by the Gnome feature.
The ~ ❯ is the end of my prompt, the current working directory (my home) and ❯ is just a fancier version of >. It’s what I prefer ever since my early days on the Amiga, I could never get used to $ at the end of a prompt.
Because I operate the system mostly with the charger plugged in. By setting both the start and end threshold, I can let the battery slowly self-discharge over weeks before the battery falls below the start charge threshold and then charges up to the end threshold.
As an extreme example, if you set the start threshold to 75% and the end threshold to 80%, it will be only like a couple of weeks with the charger plugged before it falls below 75% due to its self-discharge and charges up to 80%. I don’t know enough about battery chemistry, but I just hope that this longer time between charge cycles is better for the battery.
I did just check, though, and my start charge threshold is currently set to 50%, the end to 85%. The 35% was probably from a test and still in my shell history.
On my machine it is:
'/usr/lib/udev/hwdb.d/60-upower-battery.hwdb`
To override it I did: sudo cp /usr/lib/udev/hwdb.d/60-upower-battery.hwdb /etc/udev/hwdb.d/61-upower-battery.hwdb
Edit the file to modify what you want for charge start and stop. sudo vi /etc/udev/hwdb.d/61-upower-battery.hwdb systemd-hwdb update
But there’s no such dir as /usr/lib/udev/hwdb.d/
I use a fresh installation of Fedora 43, it is pretty much stock.
$ sudo dnf info upower
Updating and loading repositories:
Repositories loaded.
Installed packages
Name : upower
Epoch : 0
Version : 1.90.10
Release : 1.fc43
Architecture : x86_64
Installed size : 280.9 KiB
Source : upower-1.90.10-1.fc43.src.rpm
From repository : 0e44b8838a064239bd0106e9c9253add
Summary : Power Management Service
URL : https://upower.freedesktop.org/
License : GPL-2.0-or-later
Description : UPower (formerly DeviceKit-power) provides a daemon, API and c
: ommand
: line tools for managing power devices attached to the system.
Vendor : Fedora Project
This is the file that would go in /etc/udev/hwbd.d/:
# This file is part of upower.
#
# The lookup keys are composed in:
# 60-upower-battery.rules
#
# Match string format:
# battery:<kernel>:<model_name>:dmi:<dmi pattern>
#
# The kernel is the name of battery in /sys/class/power_supply for
# differentiating between multiple batteries.
#
# The model_name is battery model name in for example
# /sys/class/power_supply/BAT0/model_name.
#
# The full DMI string of the running machine can be read from
# /sys/class/dmi/id/modalias
# That requires a kernel built with CONFIG_DMIID set, which is common.
# The full DMI string is not needed here and the meaning of individual parts
# can be seen in the source of the DMIID kernel module
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/dmi-id.c
#
# To add local overrides, create a new file
# /etc/udev/hwdb.d/61-battery-local.hwdb
# and add your rules there. To load the new rules execute (as root):
# systemd-hwdb update
# udevadm trigger -v -p /sys/class/power_supply/BAT
# where BAT is the battery in question.
#
# CHARGE_LIMIT is in tuple format and each of the variables can be disabled by "_" character.
# For example:
# CHARGE_LIMIT=60,80 (charge_control_start_threshold is 60 and charge_control_end_threshold is 80.)
# CHARGE_LIMIT=_,80 (charge_control_start_threshold will be skipped and charge_control_end_threshold is 80.)
battery:*:*:dmi:*
CHARGE_LIMIT=35,85
Can you check the output of: sudo rpm -V systemd-udev upower
If there are files missing you could try reinstalling: sudo dnf reinstall systemd-udev upower
So, a tutorial for dummies like myself who use stock Fedora 43 Gnome.
Create /usr/lib/udev/hwdb.d/60-upower-battery.hwdb /etc/udev/hwdb.d/61-upower-battery.hwdb and paste this:
# This file is part of upower.
#
# The lookup keys are composed in:
# 60-upower-battery.rules
#
# Match string format:
# battery:<kernel>:<model_name>:dmi:<dmi pattern>
#
# The kernel is the name of battery in /sys/class/power_supply for
# differentiating between multiple batteries.
#
# The model_name is battery model name in for example
# /sys/class/power_supply/BAT0/model_name.
#
# The full DMI string of the running machine can be read from
# /sys/class/dmi/id/modalias
# That requires a kernel built with CONFIG_DMIID set, which is common.
# The full DMI string is not needed here and the meaning of individual parts
# can be seen in the source of the DMIID kernel module
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/dmi-id.c
#
# To add local overrides, create a new file
# /etc/udev/hwdb.d/61-battery-local.hwdb
# and add your rules there. To load the new rules execute (as root):
# systemd-hwdb update
# udevadm trigger -v -p /sys/class/power_supply/BAT
# where BAT is the battery in question.
#
# CHARGE_LIMIT is in tuple format and each of the variables can be disabled by "_" character.
# For example:
# CHARGE_LIMIT=60,80 (charge_control_start_threshold is 60 and charge_control_end_threshold is 80.)
# CHARGE_LIMIT=_,80 (charge_control_start_threshold will be skipped and charge_control_end_threshold is 80.)
battery:*:*:dmi:*
CHARGE_LIMIT=0,90
(Unless you have two batteries and want separate settings for them, just keep the asterisks in battery:*:*:dmi:*)