2022-02-11 17:56:52 -08:00

20 lines
505 B
Bash
Executable File

#!/bin/bash
status=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_VOLTAGE)
voltage=$(echo $status | cut -c26-29)
if [ "$voltage" -ge 3700 ]; then
color="#b8bb26"
else
color="#fb4934"
fi
status1=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_STATUS | tail -n1)
charge=$(echo $status1 | cut -c21-)
if [ "$charge" = "Discharging" ]; then
color1="#fb4934"
else
color1="#b8bb26"
fi
echo "<fc=$color1> </fc><fc=$color>${voltage}mV</fc>"