powerlevel9k
powerlevel9k copied to clipboard
No nmcli in MacOS Sierra
In your documentation, you reference using nmcli for wifi status. This does not exist in MacOS.
While nmcli will work for almost everything else, here's a working example for MacOS Sierra (and previous versions down to Yosemite I believe)
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="blue"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"
zsh_wifi_signal(){
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I)
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}')
if [ "$airport" = "Off" ]; then
local color='%F{yellow}'
echo -n "%{$color%}Wifi Off"
else
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}')
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}')
local color='%F{yellow}'
[[ $speed -gt 100 ]] && color='%F{green}'
[[ $speed -lt 50 ]] && color='%F{red}'
echo -n "%{$color%}$ssid $speed Mb/s%{%f%}" # removed char not in my PowerLine font
fi
}
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status battery custom_wifi_signal time)
@joeqread - Awesome! Thanks so much for putting this together!
Would you be willing to submit this as a new segment in a Pull Request? I would be happy to merge it in.
Hey @joeqread - I added this to the wiki! Thanks for sharing =)
@joeqread - Thanks!
I can not see nmcli for Mac OS Catalina