#! /bin/sh # script to display battery status and cpu temperature (on my MSI Wind) # wm: cwm # put this in your .xinitrc file # xterm -geometry 49x1-1+1 -e bin/battery-status & # (adjust geometry as needed) max=$(sysctl hw.sensors.acpibat0.amphour0) max=${max##*=} max=${max%% Ah *} while true; do cur=$(sysctl hw.sensors.acpibat0.amphour3) cur=${cur##*=} cur=${cur%% Ah *} per=$(echo "${cur} * 100 / ${max}" | bc) dot=$((${per} / 10 + 1)) dot=$(printf '%-10.*s' ${dot} '##########') deg=$(sysctl hw.sensors.cpu0.temp0 | cut -d '=' -f 2) echo -n "\rBAT: ${per}% (${cur}Ah) [${dot}]" echo -n ", CPU: ${deg}" sleep 30 done