Optimising Battery on Linux

I received my Framework 12-i3 a couple of weeks ago now, and most of that time I’ve been dialling in my Arch based KDE install to get everything functional. That’s done now. Everything works great under KDE, so now I’m starting to experiment.

I’d heard that tiling compositors were a good work environment for laptops this size, so I thought I’d install Niri and give that a go.

I now have that running (at least basically), and I’ve been amazed that my battery life estimations have gone from around 6-8 hours for a full battery, to around 17-19 hours. Obviously I wouldn’t get that if I was compiling things, or watching video. This was:

  • Browser (firefox), editor (emacs) and terminal open.
  • Looking up web pages on configuring the system, and editing files.
  • Nothing heavyweight running but how I’d likely be when coding.
  • Eco power profile, screen at 10% brightness.

Seems like the Niri based environment is allowing the CPU to go into deep sleep a lot more (according to powertop). Main drawback is tablet mode doesn’t work, and the screen brightness keys don’t either. I might be able to write scripts to manage those things, but I can live without for the moment (I still have KDE).

I just wondered if anybody else had identified any ways of optimising battery usage, either under Gnome/KDE, or anything else? There seems to be quite a lot of headroom. Maybe we can collect some battery life tips for everyone.

2 Likes

My simple strategy? Install Omarchy and set the power profile to power saver. I have not done anything empirical but I feel like the 12 is the long-lasting Framework product I have. Suspend battery use is down to ~1% an hour. Everything works as well. Everything.

Hyprland is the bee’s knees as well. Gnome and KDE are fine but very heavy DEs. So you are on the right path by moving to a tiling manger for sure.

I just installed and played with Niri on Fedora Linux.

About the tablet mode on NIri, for the auto-rotation, maybe you need to write a bash script with commands to order a rotation. Maybe the script is like the following one for the Sway window manager.

For the virtual keyboard, I am using wvkbd in Sway. But I might see that the wvkvd didn’t work on Niri in my environment. I may need to do something to fix it.

A list of on-screen keyboards is below.

One user reported they were using the following virtual keyboard on GNOME. If you are running Niri on the GNOME desktop environment, this may work.

For the screen brightness keys, it seems that the niri’s default config doesn’t have the setting to enable the keys. You need to edit your config file ~/.config/niri/config.kdl., the niri’s default config has the settings for the brightness keys. So, maybe you need to install the brightnessctl command.

You can refer to my config for Sway below. You can refer to my config for Sway about other media keys if these don’t work.

And the following ArchWiki pages may be useful. :wink:

2 Likes

It seems the commit to enable the brightness media keys is only applied to the main branch of the niri repository, but not released yet. You need to pick up the change to your config.

Hi, wondering if you had a similar experience with improved battery life on Sway and/or Niri?

Sorry, I haven’t measured the battery life on Sway, or on Niri.

1 Like

Mine’s a i3 one, I run endeavourOS with gnome on it, however instead of the default power-profiles-daemon I installed tuned & tuned-ppd, as well as using cachy kernel instead of arch, and mainly use balance and powersave mode.

I’m satisfied with the power draw under powersave mode (can idle down to I think 3~4W, and youtube playback at 7.5W with around 20% brightness setting), however it’s sluggish and not as responsive unlike balance mode, while balance mode can consume up to 11~12W for YT.

So I made a custom tuned profile inheriting the powersave profile, but then enable boost=1 (turboboost on) and set energy_performance_preference=155 (intel’s own hardware clockspeed governer, 0 for high clockspeed and 255 for lowest, 155 seems to be the sweetspot where it crank down when no user input and ramp up immediately when interacted), and this profile seems to have both the low power draw of powersave mode and responsiveness of balance mode. A downside of this profile is display is put into conservative settings it seems and can have noticable jelly effect when scrolling protrait (I don’t mind though).

Just mentioned that my FW12 draw 7% over night in sleep…

This seems to be very high to me.

Running CachyOS with default power-daemon.

Have you optimized power drain in standby?

That is 7-8 hours? If so that is ~1% drain an hour. This is the best I have seen on any Framework product, and what I am seeing on Omarchy.

Oh wow, good to hear, because to me it seemed to be much.

@DataF I measured the battery life on the Sway on Fedora Linux 42 on Framework Laptop 12 with an i5 CPU. I am running Sway directly on the console, without using GDM (GNOME Display Manager) or other display manager.

The sudo powertop showed the following result when my battery is 87% and brightness is 4%, and I opened the 2 alaccritty terminals and Firefox browser.

The battery reports a discharge rate of 6.85 W
The energy consumed was 138 J
The estimated remaining time is 7 hours, 5 minutes

That means when the battery is 100%, the estimated remaining time is calculated as follows.

(7 * 60 + 5) * 100 / 87 = 488 minutes = 8 hours 8 minutes

I am also observing the following results at various times.

The battery reports a discharge rate of 6.54 W
The energy consumed was 140 J
The estimated remaining time is 7 hours, 6 minutes
The battery reports a discharge rate of 7.04 W
The energy consumed was 131 J
The estimated remaining time is 6 hours, 34 minutes
The battery reports a discharge rate of 7.50 W
The energy consumed was 147 J
The estimated remaining time is 6 hours, 8 minutes
The battery reports a discharge rate of 7.65 W
The energy consumed was 171 J
The estimated remaining time is 6 hours, 1 minutes