mirror of
https://github.com/CoolnsX/hyprdots.git
synced 2026-06-17 07:42:07 +05:30
Does this work
This commit is contained in:
+25
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user