1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-03-19 02:17:44 +01:00

15 lines
562 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
2020-04-02 00:06:34 +02:00
# Give a battery name (e.g. BAT0) as an argument.
2020-04-02 00:06:34 +02:00
# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
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=" "
2019-09-07 17:42:18 +02:00
[ "$status" = "Charging" ] && color="#ffffff"
2019-09-07 17:42:18 +02:00
2020-03-29 11:41:01 +02:00
printf "%s%s\n" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) "