From eb578d427cb1f9d07850b0cb02b344edfde49b30 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 4 Apr 2020 09:53:41 -0600 Subject: [PATCH] Show battery wattage instead of voltage and amperage --- power.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/power.sh b/power.sh index a7cacdd..5ed1870 100755 --- a/power.sh +++ b/power.sh @@ -15,8 +15,7 @@ do if [ "${header}" == "1" ] then F="Time " - F="${F}\tBAT V" - F="${F}\tBAT A" + F="${F}\tBAT W" F="${F}\tCPU W" F="${F}\tCPU C" F="${F}\tFAN %" @@ -25,11 +24,10 @@ do uV="$(cat /sys/class/power_supply/BAT0/voltage_now)" V="$(echo "${uV}/1000000" | bc -lq)" - F="${F}\t$(printf "%.2f" "${V}")" - uA="$(cat /sys/class/power_supply/BAT0/current_now)" A="$(echo "${uA}/1000000" | bc -lq)" - F="${F}\t$(printf "%.2f" "${A}")" + bat_W="$(echo "${V} * ${A}" | bc -lq)" + F="${F}\t$(printf "%.2f" "${bat_W}")" last_E="$(cat /sys/class/powercap/intel-rapl\:0/energy_uj)" sleep 1