1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 13:50:09 +00:00

Merge pull request #1776 from ronshapiro/master

plugged_in function
This commit is contained in:
Robby Russell 2014-03-13 07:41:18 -07:00
commit e8b85f9202

View file

@ -17,12 +17,16 @@ if [[ $(uname) == "Darwin" ]] ; then
integer i=$(((currentcapacity/maxcapacity) * 100))
echo $i
}
function plugged_in() {
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
}
function battery_pct_remaining() {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
battery_pct
else
if plugged_in ; then
echo "External Power"
else
battery_pct
fi
}