diff --git a/system/home/scripts/shell/low-battery.sh b/system/home/scripts/shell/low-battery.sh new file mode 100644 index 00000000..08bf3039 --- /dev/null +++ b/system/home/scripts/shell/low-battery.sh @@ -0,0 +1,4 @@ +battery_level=$(acpi -b | grep -P -o '[0-9]+(?=%)') +if [ "$battery_level" -le 20 ]; then + notify-send -u critical "Battery low" "Battery level is ${battery_level}%!" +fi diff --git a/system/laptop.nix b/system/laptop.nix index 6eace01a..3b415a47 100644 --- a/system/laptop.nix +++ b/system/laptop.nix @@ -1,7 +1,8 @@ -{ username, ... }: +{ pkgs, username, ... }: { imports = [ ./desktop.nix ]; home-manager.users.${username}.imports = [ ./home/laptop.nix ]; + environment.systemPackages = [ pkgs.acpi ]; powerManagement.enable = true; services.auto-cpufreq = { enable = true;