diff --git a/config/dwm/scripts/bar.sh b/config/dwm/scripts/bar.sh index 06cfa280..abadd15f 100755 --- a/config/dwm/scripts/bar.sh +++ b/config/dwm/scripts/bar.sh @@ -18,10 +18,15 @@ cpu() { battery() { get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)" get_status="$(cat /sys/class/power_supply/BAT1/status)" + sent_notification=false case "$get_status" in Charging) printf "^c$blue^ 󰂄 $get_capacity" ;; Discharging) if (( $get_capacity <= 20)); then printf "^c$lightred^ 󰂃 $get_capacity" + if [ $sent_notification = false ]; then + dunstify -u critical "Battery low" "Please charge battery" + sent_notification=true + fi else printf "^c$blue^ 󰁹 $get_capacity" fi ;; diff --git a/modules/desktop/dunst/default.nix b/modules/desktop/dunst/default.nix index a272b1e6..4b0103f0 100644 --- a/modules/desktop/dunst/default.nix +++ b/modules/desktop/dunst/default.nix @@ -9,7 +9,7 @@ in }; config = mkIf cfg.enable { - users.users.sako.packages = with pkgs; [ + environment.systemPackages = with pkgs; [ dunst ]; };