1

I'm using Ubuntu 22.04 LTS and I want to know if there is a way to automatically switch to power saving mode when battery is below a specific percentage. I know there is the "Automatic Power Saver" option but how can I set it to change when below, let's say, 30%?

2 Answers2

0

You can check every minute with cron if battery dropped below for e.g. 30% and run systemctl suspend or change scaling_governor to powersave.

Also, maybe simpler, using UPower.

To get related info:

cat /etc/UPower/UPower.conf | grep -v "^#" | egrep "Critical|Low|Action|Time"

gsettings list-recursively org.gnome.settings-daemon.plugins.power

To get suspend/hibernate support, use pm-is-supported from pm-utils package.

Pablo Bianchi
  • 15,657
0

At first turn on Automatic Power Saver Turn on Automatic Power Saver Option Then open terminal and run this command and it will give the current settings for auto power saving mode.

cat /etc/UPower/UPower.conf | grep -v "^#" | egrep "Critical|Low|Action|Time"

Out put Should like below (consider the highlighted one i.e. PercentageLow=):

PercentageLow=20
PercentageCritical=5
PercentageAction=2
TimeLow=1200
TimeCritical=300
TimeAction=120
CriticalPowerAction=HybridSleep

Now edit "/etc/UPower/UPower.conf" to reflect the desired values(i.e. you have to change "PercentageLow=20" as "PercentageLow=30"(e.g. the change value indicates that auto power saving mode will turn on when battery has 30% left))

processing to edit this file

This required root priviledge

  1. sudo nano /etc/UPower/UPower.conf
  2. Now find the line "PercentageLow=20" and edit it with the desired value in which point you want to auto power saving mode turn on(e.g.PercentageLow=20 for at 20% or PercentageLow=30 for at 30%)
  3. After editing
  4. Press CTRL+O
  5. Press ENTER
  6. Press CTRL+X
  7. Reboot or Restart your system.

Now your system will automatically turn on Power Saving Mode.

zx485
  • 2,426