Xfce Forum

Sub domains
 

You are not logged in.

#1 2025-09-27 08:48:59

Mirassaqua
Member
Registered: 2020-02-02
Posts: 7
UbuntuFirefox 143.0

Power supply manager: critical battery level: 2 levels actions

Hello.

On a laptop, the power supply manager enables to set-up an action when the energy in the battery reaches a certain level. For example, at 20% we can choose to: do nothing, ask for action, go to sleep, shutdown the laptop.

My question is: is there a way to set-up a two levels scenario (with battery only, no external power supply plugged-in) ? I would like something like:
– at 20% ask me what to do,
– at 15% shutdown the laptop.
Sometimes, I have to quit my office and I am not in front of my laptop any more. The idea is: if I am here I can choose, if not the laptop shuts down a little bit latter to avoid 0% battery level.

Thank you for your help !

Offline

#2 2025-09-27 13:46:24

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,252
LinuxFirefox 143.0

Re: Power supply manager: critical battery level: 2 levels actions

xfce4-power-manager can only handle one event/action, not two like you're asking for. But you could use udev to trigger one of the events.

For example, set up xfce4-power-manager to shutdown at 15%. Then create the following udev rule:

# Rule for when switching to battery
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="20", RUN+="/usr/bin/systemd-run --machine=toz@.host --user notify-send 'Battery Level Notification' 'Capacity reached'"

...make sure you change "toz" to your username.

Also make sure to reload udev rules:

sudo udevadm control --reload

Depending on the distro you are using, the udev rule could go into /etc/udev/rules.d.

At 20%, you should get a notification. At 15% the computer will shutdown.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 529.11 KiB (Peak: 531.81 KiB) ]