Add low-battery notification script

Add acpi to laptop.nix for low-battery script
This commit is contained in:
Evie Litherland-Smith 2024-09-18 07:27:22 +01:00
parent 1863ef4f77
commit f17c2cb5a6
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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;