[Insert your commit message here. Be sure to make it descriptive.]

This commit is contained in:
coolnsx
2024-02-26 18:08:57 +05:30
parent ca2da57aa3
commit 09ab6e0765
18 changed files with 95 additions and 29 deletions

20
hypr/battery Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
i=10
dir="/sys/class/power_supply/BAT0/"
icon_dir="/usr/share/icons/Papirus/22x22/panel/"
[ -n "$1" ] && printf "Sleep for %s seconds\n" "$i"
while sleep $i; do
capacity_level=$(cat "$dir"/capacity_level)
state=$(cat "$dir"/status)
case $capacity_level in
*ritical) i=10 ;;
*ow) i=60 ;;
*) i=300 ;;
esac
[ -n "$1" ] && printf "Sleep for %s seconds\n" "$i"
[ "$state" = "Discharging" ] || continue
[ "$capacity_level" != "Normal" ] && notify-send -i "$icon_dir/battery-010.svg" -h "string:x-canonical-private-synchronous:${0##*/}" "$(cat "$dir/capacity") Battery $capacity_level, Please Plugin Charger!!" -u "$capacity_level"
done