status-bar.sh 400 B

1234567891011121314
  1. #!/bin/bash
  2. read -r temp < /sys/class/thermal/thermal_zone0/temp
  3. temp=$((temp / 1000))
  4. IFS=$',\r'
  5. read -r timestamp bat_capacity bat_volts bat_amps lid </var/log/reformd
  6. bat_amps=$(echo "scale=2;-($bat_amps/1000.0)" | bc)
  7. bat_percent=$(echo "scale=2;$bat_capacity/10000.0*100" | bc)
  8. bat_volts=$(echo "scale=2;$bat_volts/1000.0" | bc)
  9. echo "🔋$bat_percent% ${bat_amps}A ${bat_volts}V $temp°C"