btw i use nix
1#!/usr/bin/env bash
2
3INTERFACES=`nmcli -t -f DEVICE,TYPE,STATE,CONNECTION device status`
4
5SSID=`echo "$INTERFACES" | awk -F : '/wifi:connected/ {print $4}'`
6
7# if it exists, display wireless SSID with SIGNAL strenght
8if [ ! -z "$SSID" ]; then
9 echo " $SSID"
10# otherwise, if ethernet connection exists display that
11elif [ ! -z "$(echo $INTERFACES | awk -F : '/ethernet:connected/ {print $4}')" ]; then
12 echo " "
13# if wifi is enabled, display unlink
14elif [ "$(nmcli r wifi)" == "enabled" ]; then
15 echo " "
16# otherwise, display x
17else
18 echo "x"
19fi