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

31 lines
669 B
Bash
Executable File

#!/bin/sh
acpi=$(acpi -b)
if [ "$acpi" = "" ]; then
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/$//')
capacity=$(printf %3s $capacity | tr ' ' ' ')
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
echo "$icon $capacity%"