1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-03-18 18:07:45 +01:00

31 lines
669 B
Plaintext
Raw Normal View History

2023-10-22 00:05:00 +02:00
#!/bin/sh
2020-04-02 00:06:34 +02:00
2023-10-22 00:05:00 +02:00
acpi=$(acpi -b)
2019-09-07 17:42:18 +02:00
2023-10-22 00:19:06 +02:00
if [ "$acpi" = "" ]; then
2023-10-22 00:05:00 +02:00
echo ""
return
fi
total=$(echo $acpi | sed 's/.*:\ //')
status="$(echo $total | cut -d',' -f1)"
capacity="$(echo $total | cut -d',' -f2 | sed 's/%//')"
capacity=$(echo "$capacity" | sed -e 's/$//')
2023-10-17 05:36:31 +02:00
capacity=$(printf %3s $capacity | tr ' ' ' ')
2023-10-22 00:05:00 +02:00
case "$status" in
"Discharging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Not charging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Charging")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Unknown")
icon="^b#282828^^c#dfdfdf^  ^d^";;
"Full")
icon="^b#282828^^c#dfdfdf^ ⚡ ^d^";;
esac
2023-10-17 05:36:31 +02:00
echo "$icon $capacity%"