refactor(eww): Now use nmcli
for network info
This commit is contained in:
parent
a5df1080c8
commit
4277531d56
3 changed files with 5 additions and 4 deletions
|
@ -53,7 +53,6 @@
|
|||
|
||||
(defwidget connectivity []
|
||||
(eventbox
|
||||
:onclick "bash -c 'iwgtk &> /dev/null &'"
|
||||
(label
|
||||
:class "connectivity"
|
||||
:text "${
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
home.packages = [
|
||||
pkgs.eww
|
||||
# Script dependencies
|
||||
pkgs.iw
|
||||
pkgs.jq
|
||||
pkgs.dash
|
||||
pkgs.socat
|
||||
|
|
|
@ -9,6 +9,9 @@ print_network_state() {
|
|||
wlan*)
|
||||
echo wireless
|
||||
;;
|
||||
wlp*)
|
||||
echo wireless
|
||||
;;
|
||||
usb*)
|
||||
echo tethering
|
||||
;;
|
||||
|
@ -36,10 +39,10 @@ print_network_infos() {
|
|||
"$(echo "$route_line" | awk '{ print $3 }')"
|
||||
|
||||
if [ "$state" = wireless ]; then
|
||||
signal=$(iw dev "$1" link | awk '($1 == "signal:") { print $2}')
|
||||
signal=$(nmcli -m multiline device wifi | grep '^\s*SIGNAL: ' | xargs | cut -d \ -f 2)
|
||||
printf ',"wifi":{"signal":"%s","ssid":"%s"}' \
|
||||
"$(wifi_strength "$signal")" \
|
||||
"$(iw dev wlan0 info | grep '^\s*ssid ' | xargs | cut -d \ -f 2-)"
|
||||
"$(nmcli -m multiline device wifi | grep '^\s*SSID: ' | xargs | cut -d \ -f 2)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue