about summary refs log tree commit diff
path: root/users/aspen/system/home/modules/i3.nix
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-03-31T18·23-0400
committerclbot <clbot@tvl.fyi>2024-03-31T19·13+0000
commit87d5dd6371632edc9027a3e75ec6e1afc5b9d825 (patch)
treee7b74dd76f895242b57c8e1a71a08e410f6e27f4 /users/aspen/system/home/modules/i3.nix
parente0871efeaf9db8b918f549303d4dbb8e83b163d7 (diff)
feat(aspen/system): Make battery index configurable r/7824
My new laptop has the battery at index 1, not index 0

Change-Id: I64fa16e7f0eecf6b623361645d73b1176e1e5d48
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11311
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: aspen <root@gws.fyi>
Diffstat (limited to 'users/aspen/system/home/modules/i3.nix')
-rw-r--r--users/aspen/system/home/modules/i3.nix12
1 files changed, 6 insertions, 6 deletions
diff --git a/users/aspen/system/home/modules/i3.nix b/users/aspen/system/home/modules/i3.nix
index 34bd7f1b2ac6..58ec3d281460 100644
--- a/users/aspen/system/home/modules/i3.nix
+++ b/users/aspen/system/home/modules/i3.nix
@@ -39,9 +39,9 @@ in
       };
 
       battery = mkOption {
-        description = "Does this system have a battery?";
-        default = true;
-        type = types.bool;
+        description = "Battery index for this system's battery";
+        default = 0;
+        type = types.nullOr types.int;
       };
     };
   };
@@ -242,8 +242,8 @@ in
                   order += "wireless ${config.system.machine.wirelessInterface}"
                   # order += "ethernet enp3s0f0"
                   order += "cpu_usage"
-                  ${lib.optionalString (config.system.machine.battery) ''
-                      order += "battery 0"
+                  ${lib.optionalString (!isNull config.system.machine.battery) ''
+                    order += "battery ${toString config.system.machine.battery}"
                   ''}
                   # order += "volume master"
                   order += "time"
@@ -263,7 +263,7 @@ in
                       format_down = "E: -"
                   }
 
-                  battery 0 {
+                  battery ${toString config.system.machine.battery} {
                       format = "%status %percentage"
                       path = "/sys/class/power_supply/BAT%d/uevent"
                       low_threshold = 10