Add low-battery notification script
Add acpi to laptop.nix for low-battery script
This commit is contained in:
parent
1863ef4f77
commit
f17c2cb5a6
4
system/home/scripts/shell/low-battery.sh
Normal file
4
system/home/scripts/shell/low-battery.sh
Normal 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
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue