1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 04:10:07 +00:00

wifi: further cleanup

This commit is contained in:
Roman Perepelitsa 2020-09-01 11:07:49 +02:00
parent cababbeee2
commit 47c842fe8e

View file

@ -4940,15 +4940,7 @@ _p9k_prompt_wifi_async() {
SSID) ssid=$v;; SSID) ssid=$v;;
esac esac
done done
if [[ $state != running || $rssi != (0|-<->) || $noise != (0|-<->) ]]; then [[ $state == running && $rssi == (0|-<->) && $noise == (0|-<->) ]] || return 0
rssi=
noise=
last_tx_rate=
link_auth=
ssid=
return 0
fi
on=1
elif [[ -r /proc/net/wireless && -n $commands[iw] ]]; then elif [[ -r /proc/net/wireless && -n $commands[iw] ]]; then
# Content example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804): # Content example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804):
# #
@ -4963,11 +4955,7 @@ _p9k_prompt_wifi_async() {
state=${parts[2]} state=${parts[2]}
rssi=${parts[4]%.*} rssi=${parts[4]%.*}
noise=${parts[5]%.*} noise=${parts[5]%.*}
if [[ -z $iface || $state != 0## || $rssi != (0|-<->) || $noise != (0|-<->) ]]; then [[ -n $iface && $state == 0## && $rssi == (0|-<->) && $noise == (0|-<->) ]] || return 0
rssi=
noise=
return 0
fi
# Output example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804): # Output example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804):
# #
# Connected to 74:83:c2:be:76:da (on wlp3s0) # Connected to 74:83:c2:be:76:da (on wlp3s0)
@ -4992,14 +4980,7 @@ _p9k_prompt_wifi_async() {
[[ $last_tx_rate == <->.<-> ]] && last_tx_rate=${${last_tx_rate%%0#}%.} [[ $last_tx_rate == <->.<-> ]] && last_tx_rate=${${last_tx_rate%%0#}%.}
fi fi
done done
if [[ -z $ssid || -z $last_tx_rate ]]; then [[ -n $ssid && -n $last_tx_rate ]] || return 0
rssi=
noise=
ssid=
last_tx_rate=
return 0
fi
on=1
else else
return 0 return 0
fi fi
@ -5017,7 +4998,16 @@ _p9k_prompt_wifi_async() {
else else
bars=0 bars=0
fi fi
on=1
} always { } always {
if (( ! on )); then
rssi=
noise=
ssid=
last_tx_rate=
bars=
link_auth=
fi
if [[ $_p9k__wifi_on != $on || if [[ $_p9k__wifi_on != $on ||
$P9K_WIFI_LAST_TX_RATE != $last_tx_rate || $P9K_WIFI_LAST_TX_RATE != $last_tx_rate ||
$P9K_WIFI_SSID != $ssid || $P9K_WIFI_SSID != $ssid ||