fixed script

This commit is contained in:
Sakooooo 2023-08-04 18:08:05 +03:00
parent 5b2b7a3662
commit 149bfbb723
Signed by: sako
GPG key ID: 3FD715D87D7725E0

View file

@ -15,21 +15,16 @@ cpu() {
printf "^c$white^ ^b$grey^ $cpu_val" printf "^c$white^ ^b$grey^ $cpu_val"
} }
lowbattery() {
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
if (( get_capacity <= 20)); then
printf "^c$red^ Low! $get_capacity"
else
printf "^c$blue^  $get_capacity"
fi
}
battery() { battery() {
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)" get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
get_status="$(cat /sys/class/power_supply/BAT1/status)" get_status="$(cat /sys/class/power_supply/BAT1/status)"
case "$get_status" in case "$get_status" in
Charging) printf "^c$blue^ Charging $get_capacity" ;; Charging) printf "^c$blue^ Charging $get_capacity" ;;
Discharging) lowbattery() ;; Discharging) if (( $get_capacity <= 20)); then
printf "^c$red^ Low! $get_capacity"
else
printf "^c$blue^  $get_capacity"
fi ;;
esac esac
#printf "^c$blue^  $get_capacity" #printf "^c$blue^  $get_capacity"
} }