diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-09-01 12:07:49 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-09-01 12:12:55 +0300 |
commit | 47c842fe8e666e718c8ea805586fe30d0038c262 (patch) | |
tree | a1dece08e46f39972454b9a2c0be1efb7ba34e19 /internal/p10k.zsh | |
parent | cababbeee2f28c0c557522ef82fad44ac1952ba8 (diff) |
wifi: further cleanupv1.13.0
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index ea7054bc..2cba7c60 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4940,15 +4940,7 @@ _p9k_prompt_wifi_async() { SSID) ssid=$v;; esac done - if [[ $state != running || $rssi != (0|-<->) || $noise != (0|-<->) ]]; then - rssi= - noise= - last_tx_rate= - link_auth= - ssid= - return 0 - fi - on=1 + [[ $state == running && $rssi == (0|-<->) && $noise == (0|-<->) ]] || return 0 elif [[ -r /proc/net/wireless && -n $commands[iw] ]]; then # Content example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804): # @@ -4963,11 +4955,7 @@ _p9k_prompt_wifi_async() { state=${parts[2]} rssi=${parts[4]%.*} noise=${parts[5]%.*} - if [[ -z $iface || $state != 0## || $rssi != (0|-<->) || $noise != (0|-<->) ]]; then - rssi= - noise= - return 0 - fi + [[ -n $iface && $state == 0## && $rssi == (0|-<->) && $noise == (0|-<->) ]] || return 0 # Output example (https://github.com/romkatv/powerlevel10k/pull/973#issuecomment-680251804): # # 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#}%.} fi done - if [[ -z $ssid || -z $last_tx_rate ]]; then - rssi= - noise= - ssid= - last_tx_rate= - return 0 - fi - on=1 + [[ -n $ssid && -n $last_tx_rate ]] || return 0 else return 0 fi @@ -5017,7 +4998,16 @@ _p9k_prompt_wifi_async() { else bars=0 fi + on=1 } always { + if (( ! on )); then + rssi= + noise= + ssid= + last_tx_rate= + bars= + link_auth= + fi if [[ $_p9k__wifi_on != $on || $P9K_WIFI_LAST_TX_RATE != $last_tx_rate || $P9K_WIFI_SSID != $ssid || |