From 7dcb416f6d941b00f05d8f087f7af548e13e7cf9 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 23 Sep 2021 22:19:50 +0000 Subject: [PATCH] zshrc: Add power_now function --- zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zshrc b/zshrc index 154887b..15c1a7a 100644 --- a/zshrc +++ b/zshrc @@ -395,6 +395,13 @@ fi ixio() { curl -F 'f:1=<-' ix.io } 0x0st() { curl -F'file=@-' https://0x0.st } +if [ -f /sys/class/power_supply/BAT0/power_now ]; then + power_now() { + awk '{ print $1*10^-6 " W" }' \ + /sys/class/power_supply/BAT0/power_now + } +fi + cross() { if [ $# = 0 ]; then echo 'Usage: cross platform [architecture1] [architecture2]' \