mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-12-02 12:18:41 -05:00
25 lines
734 B
Plaintext
25 lines
734 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
bat_number=0
|
||
|
acpi=$(acpi -b | grep "Battery $bat_number")
|
||
|
ac_adapt=$(acpi -a | cut -d':' -f2)
|
||
|
mode=$(echo "$acpi" | cut -d',' -f1 | cut -d':' -f2)
|
||
|
percentage=$(echo "$acpi" | cut -d',' -f2 | grep -Eo '[0-9]*')
|
||
|
remain=$(echo "$acpi" | cut -d',' -f3 | awk '{print $1}' | awk -F':' '{print $1 ":" $2}')
|
||
|
|
||
|
if [ "$mode" = " Discharging" ]; then
|
||
|
echo " $percentage% $remain"
|
||
|
elif [ "$mode" = " Charging" ]; then
|
||
|
echo " $percentage% $remain"
|
||
|
elif [ "$mode" = " Full" ]; then
|
||
|
echo " $percentage%"
|
||
|
elif [ "$mode" = " Unknown" ] || [ "$mode" = " Not charging" ]; then
|
||
|
if [ "$ac_adapt" = " on-line" ]; then
|
||
|
echo " $percentage%"
|
||
|
else
|
||
|
echo " $percentage%"
|
||
|
fi
|
||
|
else
|
||
|
echo ""
|
||
|
fi
|