#!/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="#a6e22e"
else
color="#f92672"
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="#f4bf75"
else
color1="#a6e22e"
fi
echo " ${voltage}mV"