refactor(eww): Now use nmcli for network info

This commit is contained in:
GaspardCulis 2024-10-12 19:23:25 +02:00
parent a5df1080c8
commit 4277531d56
3 changed files with 5 additions and 4 deletions

View file

@ -53,7 +53,6 @@
(defwidget connectivity []
(eventbox
:onclick "bash -c 'iwgtk &> /dev/null &'"
(label
:class "connectivity"
:text "${

View file

@ -11,7 +11,6 @@
home.packages = [
pkgs.eww
# Script dependencies
pkgs.iw
pkgs.jq
pkgs.dash
pkgs.socat

View file

@ -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
}