OS X in-terminal battery notification script.
A simple notification script for your laptop battery:
ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}'
ioreg -n AppleSmartBattery -r | awk '$1~/ExternalConnected/{gsub("Yes", "+");gsub("No", "-"); print substr($0, length, 1)}'
Written by Mustapha Abiola
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Zsh
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#