mirror of
https://github.com/morten-olsen/nixos-config.git
synced 2026-02-08 00:36:27 +01:00
update
This commit is contained in:
44
user/programs/hyprland/files/eww/scripts/battery
Executable file
44
user/programs/hyprland/files/eww/scripts/battery
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
bat=/sys/class/power_supply/BAT0/
|
||||
per="$(cat "$bat/capacity")"
|
||||
|
||||
icon() {
|
||||
|
||||
[ $(cat "$bat/status") = Charging ] && echo "" && exit
|
||||
|
||||
if [ "$per" -gt "90" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "80" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "70" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "60" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "50" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "40" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "30" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "20" ]; then
|
||||
icon=""
|
||||
elif [ "$per" -gt "10" ]; then
|
||||
icon=""
|
||||
notify-send -u critical "Battery Low" "Connect Charger"
|
||||
elif [ "$per" -gt "0" ]; then
|
||||
icon=""
|
||||
notify-send -u critical "Battery Low" "Connect Charger"
|
||||
else
|
||||
echo && exit
|
||||
fi
|
||||
echo "$icon"
|
||||
}
|
||||
|
||||
percent() {
|
||||
echo $per
|
||||
}
|
||||
|
||||
[ "$1" = "icon" ] && icon && exit
|
||||
[ "$1" = "percent" ] && percent && exit
|
||||
exit
|
||||
Reference in New Issue
Block a user