From 1de270e49ffcee00b2d1841202eecfbe6349f9bc Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sat, 28 Dec 2024 15:42:47 +0300 Subject: [PATCH] Networkwidget: Call network list only once. --- package/swayscript/script/NetworkWidget.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/swayscript/script/NetworkWidget.sh b/package/swayscript/script/NetworkWidget.sh index 5d525e4..33fc935 100644 --- a/package/swayscript/script/NetworkWidget.sh +++ b/package/swayscript/script/NetworkWidget.sh @@ -2,9 +2,10 @@ function networkwidget() { local IFS=$'\n' local internet=$(nmcli networking connectivity check) - local _ethernets=($(nmcli connection show --active | rg ethernet | sed "s/ .*//")) - local _vpns=($(nmcli connection show --active | rg vpn | sed "s/ .*//")) - local _wifis=($(nmcli connection show --active | rg wifi | sed "s/ .*//")) + local _connections=($(nmcli connection show --active)) + local _ethernets=($(printf "%s\n" ${_connections[@]} | rg ethernet | sed "s/ .*//")) + local _vpns=($(printf "%s\n" ${_connections[@]} | rg vpn | sed "s/ .*//")) + local _wifis=($(printf "%s\n" ${_connections[@]} | rg wifi | sed "s/ .*//")) local _bts_raw=($(bluetoothctl devices Connected)) local _bts=() local _bt_lowest=100