mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-26 21:51:05 +01:00
plugged_in function
This commit is contained in:
parent
bc385531b0
commit
ae1973de44
1 changed files with 7 additions and 3 deletions
|
@ -16,12 +16,16 @@ if [[ $(uname) == "Darwin" ]] ; then
|
||||||
integer i=$(((currentcapacity/maxcapacity) * 100))
|
integer i=$(((currentcapacity/maxcapacity) * 100))
|
||||||
echo $i
|
echo $i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function plugged_in() {
|
||||||
|
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
function battery_pct_remaining() {
|
function battery_pct_remaining() {
|
||||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
if plugged_in ; then
|
||||||
battery_pct
|
|
||||||
else
|
|
||||||
echo "External Power"
|
echo "External Power"
|
||||||
|
else
|
||||||
|
battery_pct
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue