This commit is contained in:
Stephan Raabe
2024-04-16 21:46:53 +02:00
parent 55f7feea4f
commit 1b36fb7b1b
47 changed files with 829 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
## Get battery info
BATTERY="$(acpi | awk -F ' ' 'END {print $4}' | tr -d \%,)"
CHARGE="$(acpi | awk -F ' ' 'END {print $3}' | tr -d \,)"
main() {
if [[ ($CHARGE = *"Charging"*) && ($BATTERY -lt "100") ]]; then
echo "images/icons/battery/charge.png"
elif [[ $CHARGE = *"Full"* ]]; then
echo "images/icons/battery/full.png"
else
if [[ ($BATTERY -lt 100) && (($BATTERY -gt 65) || ($BATTERY -eq 65)) ]]; then
echo "images/icons/battery/battery-3.png"
elif [[ ($BATTERY -lt 65) && (($BATTERY -gt 35) || ($BATTERY -eq 35)) ]]; then
echo "images/icons/battery/battery-2.png"
elif [[ ($BATTERY -lt 35) && (($BATTERY -gt 10) || ($BATTERY -eq 10)) ]]; then
echo "images/icons/battery/battery-1.png"
elif [[ ($BATTERY -lt 10) && (($BATTERY -gt 0) || ($BATTERY -eq 0)) ]]; then
echo "images/icons/battery/low.png"
fi
fi
}
if [[ $1 == '--icon' ]]; then
main
elif [[ $1 == '--perc' ]]; then
echo "${BATTERY}%"
fi