diff options
author | tv <tv@krebsco.de> | 2016-07-07 23:02:41 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-07-07 23:02:41 +0200 |
commit | f18ababed59c21615d6659881a01597e18e706d3 (patch) | |
tree | e379f438eb190ed76d8d4d4c28ee1adbd8ce2bb7 /lass/3modules/power-action.nix | |
parent | 0c72da81cc58dcb68ae079901fae464249e5cec3 (diff) | |
parent | 8b829fdfa1e90635b1681ec9f466fcdc5d6e8f7e (diff) |
Merge remote-tracking branch 'prism/lassulus'
Diffstat (limited to 'lass/3modules/power-action.nix')
-rw-r--r-- | lass/3modules/power-action.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lass/3modules/power-action.nix b/lass/3modules/power-action.nix index 3116514a8..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,11 +84,11 @@ 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)" = "Discharging" ] + if [ "$(cat /sys/class/power_supply/${cfg.battery}/status)" = "Discharging" ] then echo "false" else echo "true" fi |