Can the battery charge limit be set from Linux?

Is it possible to set the charge limit to another value without having to reboot the system and enter the BIOS? I have it at 80% by default, but sometimes I want to set it to 100% while working on the laptop before I take a train/plane/automobile.
I’m running Fedora 36 and I’m hoping there’s a command I can run to set the charge limit.

4 Likes

I haven’t used it myself, but there’s an ectool you can use to set values without needing to reboot. This includes commands to query/clear/set the charge limit.

e.g. ./ectool fwchargelimit 80

4 Likes

Could you elaborate on how to install this tool? I can’t find how to install it…

You’ll find it in Exploring the Embedded Controller - #92 by prepaidpyramid

Works easily and nicely.

This is a bit of a workaround though. Many DEs provide a nice UI for changing these values and some APIs to change that behavior according to your current power scheme, for example.

Framework should just make this controllable via the sysfs interface IMO, it instantly becomes much more easy to use and discoverable for users who didn’t even know this feature exists.

4 Likes

There is a tool provided by Framework to set the charge limit

On top of this I built a service and Gnome extension to use this tool without the need of being root

3 Likes

Hey, your project looks very neat!
However the packages and binaries seem to be missing

(i.e. https://github.com/stefanhoelzl/frameworkd/blob/main/https:/github.com/stefanhoelzl/frameworkd/actions?query=branch%3Amain+is%3Asuccess leads to a 404)

Thanks for reporing!
The link is already fixed.

Here is the link to the latest build

there you can download the packages and binaries.

1 Like

Following the install instructions I get an error. Installing the rpm on fedora works, but installing the gnome extention does not:

[geert@geert-framework Downloads]$ mkdir -p ~/.local/share/gnome-shell/extensions/frameworkctl@stefanhoelzl
[geert@geert-framework Downloads]$ unzip frameworkctl@stefanhoelzl.shell-extension-zip.zip -d ~/.local/share/gnome-shell/extensions/frameworkctl@stefanhoelzl
Archive:  frameworkctl@stefanhoelzl.shell-extension-zip.zip
  inflating: /home/geert/.local/share/gnome-shell/extensions/frameworkctl@stefanhoelzl/frameworkctl@stefanhoelzl.shell-extension-zip  
[geert@geert-framework Downloads]$ gnome-extensions enable frameworkctl@stefanhoelzl
Extension “frameworkctl@stefanhoelzl” does not exist

For whatever reason frameworkctl@stefanhoelzl.shell-extension-zip.zip is a zip inside a zip. You have to unzip it, then unzip the content again, then move the files to ~/.local/share/gnome-shell/extensions/frameworkctl@stefanhoelzl.

1 Like

Thank you for responding, but after unzipping the file again it still won’t install…

[geert@geert-framework frameworkctl@stefanhoelzl]$ pwd
/home/geert/.local/share/gnome-shell/extensions/frameworkctl@stefanhoelzl
[geert@geert-framework frameworkctl@stefanhoelzl]$ ll
total 16
-rw-r--r--. 1 geert geert 5363 Apr  3 19:14 extension.js
drwxr-xr-x. 1 geert geert  178 Apr  3 19:14 icons
-rw-r--r--. 1 geert geert  151 Apr  3 19:14 metadata.json
-rw-r--r--. 1 geert geert   45 Apr  3 19:14 stylesheet.css
[geert@geert-framework frameworkctl@stefanhoelzl]$ gnome-extensions enable frameworkctl@stefanhoelzl
Extension “frameworkctl@stefanhoelzl” does not exist

The plugins metadata suggest it requires version 45 while I’m on version 42.5 apparently.

[geert@geert-framework frameworkctl@stefanhoelzl]$ gnome-shell --version
GNOME Shell 42.5
[geert@geert-framework frameworkctl@stefanhoelzl]$ cat metadata.json 
{
  "name": "FrameworkCtl",
  "description": "Controls Framework Laptops.",
  "uuid": "frameworkctl@stefanhoelzl",
  "shell-version": [
    "45"
  ]
}

I’ll see if updating Fedora helps…

(some time later)
… yes that solved it. Updated to latest Fedora version and it works now.

1 Like

Thank you for sharing your issues and what fixed them!
I will fix them or update the docs soon!

2 Likes