Skip to content

Instantly share code, notes, and snippets.

@marmakoide
Last active January 4, 2021 11:02
Show Gist options
  • Save marmakoide/9f45b23b975d06ddbf8e6778be6dcaae to your computer and use it in GitHub Desktop.
Save marmakoide/9f45b23b975d06ddbf8e6778be6dcaae to your computer and use it in GitHub Desktop.
Shell script that generates a string describing network connection status, to use with dwmblocks and Font Awesome
#!/bin/sh
ETH_IT=enp3s0
WLAN_IT=wlan0
is_eth_used=$(cat /sys/class/net/${ETH_IT}/carrier)
is_wlan_used=$(cat /sys/class/net/${WLAN_IT}/carrier)
if [ "$is_eth_used" -eq 1 ]; then # wired network is carrying
icon="" #uF6FF
elif [ "$is_wlan_used" -eq 1 ]; then # wireless network is carrying
icon="" #uF1EB
else
icon="" #uf128 # no network
fi
echo $icon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment