network-symbol.sh (386B)
1 #!/bin/bash 2 (echo start; nmcli monitor) | while read _; do 3 state=$(LC_ALL=C nmcli -t -f type,state d) 4 5 if grep -Fq 'ethernet:connected' <<< "$state"; then 6 printf '\uf0c1\nconnected via ethernet\n' 7 elif grep -Fq 'wifi:connected' <<< "$state"; then 8 printf '\uf1eb\nconnected via wifi\n' 9 else 10 printf '\uf127\ndisconnected\ndisconnected' 11 fi 12 done