pointfichiers/bar/eww/scripts/get-connectivity

18 lines
306 B
Bash
Executable file

#!/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)"
fi
echo "{\"status\": \"$status\", \"ssid\": \"$ssid\"}"
}
status
iwevent 2> /dev/null | while read -r line; do
status
done