I'm writing a bar script and I don't want to check WiFi's ssid and it's state every 20/30 seconds when I know that it won't change for a while. I would like to use something like bspc's command subscribe report which updates only if there is a change.
Here is what I have for context:
while : do case "con=$(cat /sys/class/net/w*/operstate 2>/dev/null)" in [Dd]*) ssid='No Connection' ;; [Uu]*) ssid=$(iwgetid -r) ;; esac echo "$ssid" sleep 30 done