|
|
@ -5312,7 +5312,8 @@ prompt_wifi() {
|
|
|
|
|
|
|
|
|
|
|
|
_p9k_prompt_wifi_init() {
|
|
|
|
_p9k_prompt_wifi_init() {
|
|
|
|
if [[ -x /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport ||
|
|
|
|
if [[ -x /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport ||
|
|
|
|
-r /proc/net/wireless && -n $commands[iw] ]]; then
|
|
|
|
-r /proc/net/wireless && -n $commands[iw] ]] ||
|
|
|
|
|
|
|
|
(( _POWERLEVEL9K_USE_DANGEROUS_TERMUX_API && $+commands[termux-wifi-connectioninfo] )); then
|
|
|
|
typeset -g _p9k__wifi_on=
|
|
|
|
typeset -g _p9k__wifi_on=
|
|
|
|
typeset -g P9K_WIFI_LAST_TX_RATE=
|
|
|
|
typeset -g P9K_WIFI_LAST_TX_RATE=
|
|
|
|
typeset -g P9K_WIFI_SSID=
|
|
|
|
typeset -g P9K_WIFI_SSID=
|
|
|
@ -5388,6 +5389,33 @@ _p9k_prompt_wifi_async() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
[[ -n $ssid && -n $last_tx_rate ]] || return 0
|
|
|
|
[[ -n $ssid && -n $last_tx_rate ]] || return 0
|
|
|
|
|
|
|
|
# Output example (https://wiki.termux.com/wiki/Termux-wifi-connectioninfo):
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# {
|
|
|
|
|
|
|
|
# "bssid": "02:00:00:00:00:00",
|
|
|
|
|
|
|
|
# "frequency_mhz": 2412,
|
|
|
|
|
|
|
|
# "ip": "100.64.135.224",
|
|
|
|
|
|
|
|
# "link_speed_mbps": 117,
|
|
|
|
|
|
|
|
# "mac_address": "02:00:00:00:00:00",
|
|
|
|
|
|
|
|
# "network_id": -1,
|
|
|
|
|
|
|
|
# "rssi": -65,
|
|
|
|
|
|
|
|
# "ssid": "<unknown ssid>",
|
|
|
|
|
|
|
|
# "ssid_hidden": true,
|
|
|
|
|
|
|
|
# "supplicant_state": "COMPLETED"
|
|
|
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
elif (( _POWERLEVEL9K_USE_DANGEROUS_TERMUX_API && $+commands[termux-wifi-connectioninfo] )); then
|
|
|
|
|
|
|
|
local json
|
|
|
|
|
|
|
|
json=$(command termux-wifi-connectioninfo) || return 0
|
|
|
|
|
|
|
|
[[ $json == *'"supplicant_state"'[[:space:]]#:[[:space:]]#'"COMPLETED"' ]] || return 0
|
|
|
|
|
|
|
|
local -a match mbegin mend
|
|
|
|
|
|
|
|
[[ $json == (#b)*'"rssi"'[[:space:]]#:[[:space:]]#(()) ]] || return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
on=1
|
|
|
|
|
|
|
|
rssi=$(jq -nr "$info | .rssi")
|
|
|
|
|
|
|
|
last_tx_rate=$(jq -nr "$info | .link_speed_mbps")
|
|
|
|
|
|
|
|
if [[ $(jq -nr "$info | .ssid_hidden") == false ]]; then
|
|
|
|
|
|
|
|
ssid=$(jq -nr "$info | .ssid")
|
|
|
|
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -7431,6 +7459,10 @@ _p9k_init_params() {
|
|
|
|
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
|
|
|
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
|
|
|
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
|
|
|
|
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
|
|
|
|
_p9k_declare -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS -- status root_indicator background_jobs history time
|
|
|
|
_p9k_declare -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS -- status root_indicator background_jobs history time
|
|
|
|
|
|
|
|
# By default, powerlevel10k won't invoke Termux API utilities because
|
|
|
|
|
|
|
|
# they can hang. See https://github.com/termux/termux-packages/issues/334.
|
|
|
|
|
|
|
|
# This option allows powerlevel10k to make these calls.
|
|
|
|
|
|
|
|
_p9k_declare -b POWERLEVEL9K_USE_DANGEROUS_TERMUX_API 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_DISABLE_RPROMPT 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_DISABLE_RPROMPT 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_PROMPT_ADD_NEWLINE 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_PROMPT_ADD_NEWLINE 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_PROMPT_ON_NEWLINE 0
|
|
|
|
_p9k_declare -b POWERLEVEL9K_PROMPT_ON_NEWLINE 0
|
|
|
|