pointfichiers/bar/eww/scripts/get-connectivity

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