mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
18 lines
492 B
Plaintext
Executable File
18 lines
492 B
Plaintext
Executable File
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>"
|