Does this work

This commit is contained in:
2026-05-18 16:36:44 +05:30
parent b370921034
commit 2692a446ed
17 changed files with 167 additions and 62 deletions
+25 -5
View File
@@ -1,7 +1,7 @@
#!/bin/sh
remind() {
notify-send -e -i "$icon_dir/battery-010.svg" -h "string:x-canonical-private-synchronous:${0##*/}" "$1 % Battery $2, Please Plugin Charger!!" -u "$2"
notify() {
notify-send -e -i "$icon_dir/$1" -h "string:x-canonical-private-synchronous:${0##*/}" "$2" -u "${3:-normal}"
}
print_sleep() {
@@ -12,9 +12,29 @@ print_sleep() {
#declaration
battery="BAT0" #change accordingly
dir="/sys/class/power_supply/$battery/"
icon_dir="/usr/share/icons/Papirus/22x22/panel/" #change accordingly
icon_dir="/usr/share/icons/Papirus-Dark/22x22/panel/" #change accordingly
i=0
status="normal"
charge=$(cat "$dir"/capacity)
power_status=$(cat "$dir"/status)
case "$1" in
ac)
notify "battery-$(( charge / 10))0-charging.svg" "Power: AC Mode ($charge % $power_status)"
hyprctl keyword decoration:blur:enabled true
hyprctl keyword decoration:shadow:enabled true
exit 0
;;
battery)
notify "battery-$(( charge / 10))0.svg" "Power: Battery Mode ($charge % $power_status)"
hyprctl keyword decoration:blur:enabled false
hyprctl keyword decoration:shadow:enabled false
exit 0
;;
*) ;;
esac
#infinite loop
while charge=$(cat "$dir"/capacity); do
@@ -41,7 +61,7 @@ while charge=$(cat "$dir"/capacity); do
esac
# remind appropriately
[ "$status" != "normal" ] && remind "$charge" "$status"
[ "$status" != "normal" ] && notify "battery-010.svg" "$charge % Battery $status, Please Plugin Charger!!" "$status"
fi
print_sleep "$i" "$charge" "$status" "$1" #pass 'log' as argument to print logs
print_sleep "$i" "$charge" "$status" "$2" #pass 'log' as argument to print logs
done