dotfiles/.local/bin/watts
2024-05-21 11:11:52 -04:00

8 lines
215 B
Bash
Executable File

#!/usr/bin/env sh
current=$(sysctl -n hw.sensors.acpibat0.current0|cut -f1 -d' ')
voltage=$(sysctl -n hw.sensors.acpibat0.volt1|cut -f1 -d' ')
watts=$(bc -e "scale=2;$current*$voltage" -e "quit")
echo "${watts}W"