pointfichiers/bar/eww/scripts/get-connectivity

19 lines
306 B
Text
Raw Normal View History

2024-01-25 14:39:08 +01:00
#!/bin/dash
if=$1
status (){
status=$(cat /sys/class/net/wlan0/operstate)
if [ "$status" != "down" ]; then
ssid="$(iw dev wlan0 link | grep SSID | cut -d':' -f2)"
2024-01-25 14:39:08 +01:00
fi
echo "{\"status\": \"$status\", \"ssid\": \"$ssid\"}"
}
status
iwevent 2> /dev/null | while read -r line; do
status
done