dotfiles/.local/bin/watts

8 lines
215 B
Plaintext
Raw Permalink Normal View History

2024-05-21 17:11:52 +02:00
#!/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"