diff options
author | Jesse Luehrs <doy@stripe.com> | 2018-11-12 09:16:07 -0800 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-11-12 09:19:45 -0800 |
commit | ab4754b16e3685ff7758f2628bc432726242132d (patch) | |
tree | 7625b6b1c1120f07701c8a37b7d52ddae30b5c41 /bin | |
parent | 0954f16ef2b45479b0169a223bb3d4765bb212e2 (diff) | |
download | conf-ab4754b16e3685ff7758f2628bc432726242132d.tar.gz conf-ab4754b16e3685ff7758f2628bc432726242132d.zip |
add power usage to my menu bar in osx
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/st-doy1.local/power-usage | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/st-doy1.local/power-usage b/bin/st-doy1.local/power-usage new file mode 100755 index 0000000..46d61db --- /dev/null +++ b/bin/st-doy1.local/power-usage @@ -0,0 +1,10 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; + +my $power_data = `system_profiler SPPowerDataType`; +my ($volts) = $power_data =~ /Voltage.*: (.*)/; +my ($amps) = $power_data =~ /Amperage.*: (.*)/; + +printf "%0.2f\n", $volts * $amps / 1000000; |