Improve battery systemd-unit
This commit is contained in:
parent
f70683bbd5
commit
8e188d9de7
1 changed files with 4 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
battery-watch = pkgs.writeShellScriptBin "battery-watch" ''
|
battery-watch = pkgs.writeScript "battery-watch" ''
|
||||||
|
#!${pkgs.stdenv.shell}
|
||||||
|
|
||||||
critical_level=20 #percent
|
critical_level=20 #percent
|
||||||
|
|
||||||
while true
|
while true
|
||||||
|
@ -29,7 +31,7 @@ config = mkIf config.m-0.battery.enable {
|
||||||
Description = "Watch battery state and warn user";
|
Description = "Watch battery state and warn user";
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart="/bin/sh ${battery-watch}/bin/battery-watch";
|
ExecStart=toString battery-watch;
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "graphical-session.target" ];
|
WantedBy = [ "graphical-session.target" ];
|
||||||
|
|
Loading…
Reference in a new issue