mirror of https://github.com/tiyn/dotfiles
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
497 B
13 lines
497 B
#!/usr/bin/env sh
|
|
# Give a battery name (e.g. BAT0) as an argument.
|
|
|
|
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
|
|
time=$(acpi | awk '{ print $5 }')
|
|
status=$(cat /sys/class/power_supply/"$1"/status)
|
|
|
|
[ -z $warn ] && warn=" "
|
|
|
|
[ "$status" = "Charging" ] && color="#ffffff"
|
|
|
|
printf "%s%s%s\n" "$(echo "$status" | sed -e "s/,//;s/Discharging/-/;s/Not Charging/X/;s/Charging/+/;s/Unknown/0/;s/Full/F/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) " " ($time)"
|