add low battery notification and add dunst to system-path
This commit is contained in:
parent
574e89ba17
commit
080834aa77
2 changed files with 6 additions and 1 deletions
|
@ -18,10 +18,15 @@ cpu() {
|
||||||
battery() {
|
battery() {
|
||||||
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
|
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
|
||||||
get_status="$(cat /sys/class/power_supply/BAT1/status)"
|
get_status="$(cat /sys/class/power_supply/BAT1/status)"
|
||||||
|
sent_notification=false
|
||||||
case "$get_status" in
|
case "$get_status" in
|
||||||
Charging) printf "^c$blue^ $get_capacity" ;;
|
Charging) printf "^c$blue^ $get_capacity" ;;
|
||||||
Discharging) if (( $get_capacity <= 20)); then
|
Discharging) if (( $get_capacity <= 20)); then
|
||||||
printf "^c$lightred^ $get_capacity"
|
printf "^c$lightred^ $get_capacity"
|
||||||
|
if [ $sent_notification = false ]; then
|
||||||
|
dunstify -u critical "Battery low" "Please charge battery"
|
||||||
|
sent_notification=true
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf "^c$blue^ $get_capacity"
|
printf "^c$blue^ $get_capacity"
|
||||||
fi ;;
|
fi ;;
|
||||||
|
|
|
@ -9,7 +9,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
users.users.sako.packages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
dunst
|
dunst
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue