about summary refs log tree commit diff
path: root/users/glittershark/system
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/system')
-rw-r--r--users/glittershark/system/system/machines/chupacabra.nix2
-rw-r--r--users/glittershark/system/system/machines/yeren.nix2
-rw-r--r--users/glittershark/system/system/modules/laptop.nix13
-rw-r--r--users/glittershark/system/system/modules/reusable/battery.nix4
4 files changed, 17 insertions, 4 deletions
diff --git a/users/glittershark/system/system/machines/chupacabra.nix b/users/glittershark/system/system/machines/chupacabra.nix
index d2060f9ab31b..4f7f39ee5aa1 100644
--- a/users/glittershark/system/system/machines/chupacabra.nix
+++ b/users/glittershark/system/system/machines/chupacabra.nix
@@ -3,7 +3,7 @@
 {
   imports = [
     ../modules/common.nix
-    ../modules/reusable/battery.nix
+    ../modules/laptop.nix
     ../modules/tvl.nix
     ../modules/fcitx.nix
     ../modules/rtlsdr.nix
diff --git a/users/glittershark/system/system/machines/yeren.nix b/users/glittershark/system/system/machines/yeren.nix
index 7e55f68d0fc0..29dde88bbedb 100644
--- a/users/glittershark/system/system/machines/yeren.nix
+++ b/users/glittershark/system/system/machines/yeren.nix
@@ -4,7 +4,7 @@
   imports = [
     (modulesPath + "/installer/scan/not-detected.nix")
     ../modules/common.nix
-    ../modules/reusable/battery.nix
+    ../modules/laptop.nix
     ../modules/xserver.nix
     ../modules/fonts.nix
     ../modules/sound.nix
diff --git a/users/glittershark/system/system/modules/laptop.nix b/users/glittershark/system/system/modules/laptop.nix
new file mode 100644
index 000000000000..8c09f3a44266
--- /dev/null
+++ b/users/glittershark/system/system/modules/laptop.nix
@@ -0,0 +1,13 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ./reusable/battery.nix
+  ];
+
+  laptop.onLowBattery.enable = true;
+
+  services.logind.extraConfig = ''
+    HandlePowerKey=hibernate
+  '';
+}
diff --git a/users/glittershark/system/system/modules/reusable/battery.nix b/users/glittershark/system/system/modules/reusable/battery.nix
index d7043bf54979..ca92e0c3f61c 100644
--- a/users/glittershark/system/system/modules/reusable/battery.nix
+++ b/users/glittershark/system/system/modules/reusable/battery.nix
@@ -7,7 +7,7 @@ with lib;
 
       thresholdPercentage = mkOption {
         description = "Threshold battery percentage on which to perform the action";
-        default = 5;
+        default = 8;
         type = types.int;
       };
 
@@ -26,7 +26,7 @@ with lib;
       ''SUBSYSTEM=="power_supply", ''
       ''ATTR{status}=="Discharging", ''
       ''ATTR{capacity}=="[0-${toString cfg.thresholdPercentage}]", ''
-      ''RUN+="/${pkgs.systemd}/bin/systemctl ${cfg.action}"''
+      ''RUN+="${pkgs.systemd}/bin/systemctl ${cfg.action}"''
     ];
   };
 }