dotfiles/home/dot_config/xmobar/executable_mouse

20 lines
506 B
Plaintext
Raw Normal View History

2022-12-10 17:09:35 -08:00
#!/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
2023-05-07 16:51:37 -07:00
color="#a6e22e"
2022-12-10 17:09:35 -08:00
else
2023-05-07 16:51:37 -07:00
color="#f92672"
2022-12-10 17:09:35 -08:00
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
2023-05-07 16:51:37 -07:00
color1="#f4bf75"
2022-12-10 17:09:35 -08:00
else
2023-05-07 16:51:37 -07:00
color1="#a6e22e"
2022-12-10 17:09:35 -08:00
fi
2023-05-07 16:51:37 -07:00
echo "<fc=$color1>󰦋 </fc><fc=$color>${voltage}mV</fc>"