eww fix battery for desktop

This commit is contained in:
2025-05-03 15:03:05 +02:00
parent bf3abbbeae
commit 4c54b587bc
3 changed files with 11 additions and 2 deletions

View File

@@ -3,7 +3,9 @@ stat=$(cat /sys/class/power_supply/AC/online)
class="batteryFull" class="batteryFull"
if [[ $stat == 1 ]]; then if [ ! -d "/sys/class/power_supply/BAT0" ]; then
class="batteryFull"
elif [[ $stat == 1 ]]; then
class="batteryCharging" class="batteryCharging"
elif [[ $bat -le 10 ]]; then elif [[ $bat -le 10 ]]; then
class="batteryEmpty" class="batteryEmpty"

View File

@@ -3,7 +3,9 @@ stat=$(cat /sys/class/power_supply/AC/online)
icon="" icon=""
if [[ $stat == 1 ]]; then if [ ! -d "/sys/class/power_supply/BAT0" ]; then
icon=""
elif [[ $stat == 1 ]]; then
icon="" icon=""
elif [[ $bat -le 10 ]]; then elif [[ $bat -le 10 ]]; then
icon="" icon=""

View File

@@ -1,2 +1,7 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity) bat=$(cat /sys/class/power_supply/BAT0/capacity)
if [ ! -d "/sys/class/power_supply/BAT0" ]; then
bat="100"
fi
echo "$bat" echo "$bat"