about summary refs log tree commit diff
path: root/machines/sternenseemann
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-03-02 22:02:30 +0100
committersternenseemann <sternenseemann@systemli.org>2022-03-02 22:07:13 +0100
commitda978ff35ac851daf060d36b82920f09f5fcccfe (patch)
treeac57149549e80196df623c1fdf9fe50451a86f33 /machines/sternenseemann
parenta6a2ba7139adf1a5661c21d79217f19d8e620f62 (diff)
machines/sternenseemann: use upower over low-battery
I had some weird issues with the low-battery udev rule, mainly it not
triggering when it should. Usually, the event would only get processed
when the battery changed state, e.g. from Discharging to Charging.
Consequently, the laptop would hibernate when you'd save it from running
out of battery by plugging it in, but, if you forgot, it'd be content to
run out of battery.

I'll try upower instead now which is the “normal” solution used by the
major desktop environments. It's has some extra complexity, as it also
provides a d-bus API for other applications to use, but we'll see how it
goes.
Diffstat (limited to 'machines/sternenseemann')
-rw-r--r--machines/sternenseemann/base-laptop.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/machines/sternenseemann/base-laptop.nix b/machines/sternenseemann/base-laptop.nix
index 62fdd7e4..6d1a6ab5 100644
--- a/machines/sternenseemann/base-laptop.nix
+++ b/machines/sternenseemann/base-laptop.nix
@@ -26,10 +26,14 @@
     powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
 
     vuizvui.hardware.thinkpad.enable = lib.mkDefault true;
-    vuizvui.hardware.low-battery = {
+    services.upower = {
       enable = true;
-      treshold = 3;
-      action = "hibernate";
+      usePercentageForPolicy = true;
+      criticalPowerAction = "Hibernate";
+
+      percentageLow = 15;
+      percentageCritical = 10;
+      percentageAction = 8;
     };
 
     programs.mosh.enable = true;