.dotfiles/private_dot_config/eww/scripts/get-battery-icon.sh

23 lines
562 B
Bash
Executable File

#!/bin/bash
# Détermine l'icône de batterie appropriée
while true; do
capacity=$(cat /sys/class/power_supply/BAT0/capacity 2>/dev/null || echo "0")
status=$(cat /sys/class/power_supply/BAT0/status 2>/dev/null || echo "Unknown")
if [ "$status" = "Charging" ]; then
echo "󰂄"
elif [ $capacity -ge 90 ]; then
echo ""
elif [ $capacity -ge 70 ]; then
echo ""
elif [ $capacity -ge 40 ]; then
echo ""
elif [ $capacity -ge 20 ]; then
echo ""
else
echo ""
fi
sleep 5
done