From cbf0038c6fd63160816b0f758a4c777c5bb63f08 Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 17 Feb 2021 03:50:33 +0100 Subject: [PATCH] Suspend when the battery is low --- modules/power.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/power.nix b/modules/power.nix index 367f8fd..3e2f52d 100644 --- a/modules/power.nix +++ b/modules/power.nix @@ -37,11 +37,8 @@ }; }; - # Suspend to RAM/disk when battery is critical - services.upower = { - enable = true; - percentageLow = 15; - percentageCritical = 10; - percentageAction = 7; - }; + # Suspend when the battery is critical + services.udev.extraRules = '' + SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{model_name}=="01AV405", ATTR{capacity}=="[0-5]", RUN+="${config.systemd.package}/bin/systemctl suspend -i" + ''; }