Config to hibernate when battery is critically low

#1

I want to make my laptop hibernate when battery is critically low but can’t find the config for that.

1 Like

#2

Maybe you could do the equivalent of this: https://wiki.archlinux.org/index.php/laptop#Hibernate_on_low_battery_level

0 Likes

#3

The stockholm repository has something similar to what you are looking for, it is a module which provides the means to trigger actions for different power levels (e.g. between 25% and 15% or below 15%): https://git.shackspace.de/krebs/stockholm/blob/master/krebs/3modules/power-action.nix

This is how i use the module for my laptop:

If you do not want the full-fledge version then you can probably copy-paste the relevant parts into your config

0 Likes

#4

Funny, just an hour ago I added code for that to my config.


But if your battery sends discharging events, you probably want a udev rule (as described in the arch wiki).

1 Like

#5

Great to learn about these. Thank you all.

1 Like