summaryrefslogtreecommitdiffstats
path: root/lass/3modules/power-action.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lass/3modules/power-action.nix')
-rw-r--r--lass/3modules/power-action.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/lass/3modules/power-action.nix b/lass/3modules/power-action.nix
index 06a316270..30875c9a9 100644
--- a/lass/3modules/power-action.nix
+++ b/lass/3modules/power-action.nix
@@ -12,6 +12,10 @@ let
api = {
enable = mkEnableOption "power-action";
+ battery = mkOption {
+ type = types.str;
+ default = "BAT0";
+ };
user = mkOption {
type = types.user;
default = {
@@ -80,13 +84,13 @@ let
"if [ $power -ge ${toString plan.lowerLimit} ] && [ $power -le ${toString plan.upperLimit} ] ${charging_check plan}; then ${plan.action}; fi";
powerlvl = pkgs.writeDash "powerlvl" ''
- cat /sys/class/power_supply/BAT0/capacity
+ cat /sys/class/power_supply/${cfg.battery}/capacity
'';
state = pkgs.writeDash "state" ''
- if [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ]
- then echo "true"
- else echo "false"
+ if [ "$(cat /sys/class/power_supply/${cfg.battery}/status)" = "Discharging" ]
+ then echo "false"
+ else echo "true"
fi
'';