diff options
author | sys-lectern <sys_lectern@tutamail.com> | 2020-08-25 23:04:47 +0300 |
---|---|---|
committer | sys-lectern <sys_lectern@tutamail.com> | 2020-08-25 23:04:47 +0300 |
commit | 16cb58d15f5bb602bf7a0d09dcf6011544a8fc0e (patch) | |
tree | 5b996175814aba8251e934e692b8c1a875eb1e1b /internal | |
parent | 8f90ed6d4992f51bb445555d6e826442d36be4f2 (diff) |
minor fixes and syntax improvements
Diffstat (limited to 'internal')
-rw-r--r-- | internal/p10k.zsh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 59a10758..985d417a 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4945,15 +4945,15 @@ _p9k_prompt_wifi_async() { esac done - elif [[ $_p9k_os == (Linux|Android)]]; then + elif [[ $_p9k_os == Linux]]; then # iw tools only output 'noise' from a dump that requires superuser and a background service to be running, which probably isn't, so a separate process is needed # /proc/net/wireless displays noise level up to date, w/o requiring superuser local proc_less=/proc/net/wireless [[ -f $proc_less ]] || return 0 - # this method using iw is over 10x faster than the network manager method in benchmarking - # it's possible some systems are still using 'wireless_tools' (iw's ancestor) but they are long deprecated anyway - local device="$(iw dev | grep 'Interface ' | cut -d\ -f2)" || return 0 + # this method using iw is over 10x faster than the network manager method in benchmarking + # it's possible some systems are still using 'wireless_tools' (iw's ancestor) but they are long deprecated anyway + local device="$(cut -d\ -f2 <<< $(iw dev | grep Interface))" || return 0 out="$(iw dev $device link)" || return 0 # 'running' state guaranteed by 'device' and 'proc_less' var assignment @@ -4961,8 +4961,8 @@ _p9k_prompt_wifi_async() { local proc_out="$(grep $device $proc_less | tr -s ' ')" || return 0 # using cut is more performant than awk,sed,perl, but I haven't timed against zsh expansion pattern - rssi="${$($proc_out | cut -d\ -f4)%.*}" - noise="$($proc_out | cut -d\ -f5)" + rssi="${$(cut -d\ -f4 <<< $proc_out)%.*}" + noise="$(cut -d\ -f5 <<< $proc_out)" # it's possible to get boolean from iw to check authorization status from a dump, but getting the method (if any) requires superuser link_auth="" @@ -4978,7 +4978,7 @@ _p9k_prompt_wifi_async() { # formatting here to transform from 'xxx.x MBit/s MCS xx short GI' to 'xxx.x' where x's are integers # benchmarking shows grep here is extremely fast (under .1 msc even on older hw), but you can change to native zsh pattern if you want - tx\ bitrate) last_tx_rate=$(echo $v | grep -o "^[0-9]+.[0-9]");; + tx\ bitrate) last_tx_rate=$(cut -d\ -f1 <<< $v);; esac done fi |