1#!/usr/bin/zsh
2STATE=$(nmcli -t -f STATE g)
3CONNECTIVITY=$(nmcli -t -f CONNECTIVITY g)
4
5if [[ "$STATE" != "connected" ]]; then
6 echo "{\"text\": \"\"}"
7 exit 0
8fi
9
10if [[ "$CONNECTIVITY" == "full" ]]; then
11 ICON="" # full connectivity
12elif [[ "$CONNECTIVITY" == "limited" ]]; then
13 ICON="" # limited connectivity
14else
15 ICON="" # no connectivity
16fi
17
18SSID=$(nmcli -t -f ACTIVE,SSID dev wifi | grep '^yes' | cut -d: -f2)
19echo "{\"text\": \"$ICON\", \"tooltip\": \"$SSID\"}"