Merge pull request #702 from nwinkler/battery-ac-osx
Added AC indicator support on OS Xpull/709/head
commit
d25835fbb9
|
|
@ -2,15 +2,15 @@ cite about-plugin
|
||||||
about-plugin 'display info about your battery charge level'
|
about-plugin 'display info about your battery charge level'
|
||||||
|
|
||||||
ac_adapter_connected(){
|
ac_adapter_connected(){
|
||||||
if command_exists acpi;
|
if command_exists acpi;
|
||||||
then
|
then
|
||||||
acpi -a | grep "on-line"
|
acpi -a | grep -q "on-line"
|
||||||
if [[ "$?" -eq 0 ]]; then
|
return $?
|
||||||
return 1
|
elif command_exists ioreg;
|
||||||
else
|
then
|
||||||
return 0
|
ioreg -n AppleSmartBattery -r | grep -q '"ExternalConnected" = Yes'
|
||||||
fi
|
return $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
battery_percentage(){
|
battery_percentage(){
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ LAST_STATUS_THEME_PROMPT_COLOR=196
|
||||||
|
|
||||||
CLOCK_THEME_PROMPT_COLOR=240
|
CLOCK_THEME_PROMPT_COLOR=240
|
||||||
|
|
||||||
BATTERY_AC_CHAR="⚡"
|
BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"}
|
||||||
BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70
|
BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70
|
||||||
BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208
|
BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208
|
||||||
BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160
|
BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160
|
||||||
|
|
@ -153,7 +153,7 @@ function __powerline_battery_prompt {
|
||||||
else
|
else
|
||||||
color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}"
|
color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}"
|
||||||
fi
|
fi
|
||||||
[[ "$(ac_adapter_connected)" ]] && battery_status="${BATTERY_AC_CHAR}${battery_status}"
|
ac_adapter_connected && battery_status="${BATTERY_AC_CHAR}${battery_status}"
|
||||||
echo "${battery_status}%|${color}"
|
echo "${battery_status}%|${color}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue