summaryrefslogtreecommitdiff
path: root/dot-config/sketchybar/plugins/network.sh
blob: e1790ae4562c1448990fedf622c7ae8f08e871c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

NETWORK="$(scutil --nwi | awk -F': ' '/Network interfaces/ {print $2;}')"

# Split devices into array
IFS=' ' read -ra SERVICES <<< "$NETWORK"

# Check the first device
case "${SERVICES}" in
	# check if no devices
	"") ICON="󰤯"
	;;
	# if en0, then wifi
	"en0") ICON=""
	;;
	# else, must be hardwired
	*) ICON=""
esac

sketchybar --set "$NAME" icon="$ICON"