Added ethernet module

This commit is contained in:
Manuel Palenzuela 2019-10-21 20:22:57 +01:00
parent b4cd124c6c
commit 69c852b4a5
2 changed files with 19 additions and 10 deletions

16
modules/ethernet Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# Prints out if there is an ethernet cable connected
ETHERNET_ICON=''
get_ethernet()
{
if [ -d /sys/class/net/eth? ]; then
if [ "$(cat /sys/class/net/eth?/carrier)" == "1" ]; then
echo "$ETHERNET_ICON"
fi
fi
}
get_ethernet

View file

@ -1,13 +1,12 @@
#!/bin/bash
# Gets the network status
# Gets the wifi status
WIFI_FULL_ICON=''
WIFI_MID_ICON=''
WIFI_LOW_ICON=''
ETHERNET_ICON=''
get_network()
get_wifi()
{
if grep -q wlan* "/proc/net/wireless"; then
# Wifi quality percentage
@ -18,13 +17,7 @@ get_network()
2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;;
esac
fi
if [ -d /sys/class/net/eth? ]; then
if [ "$(cat /sys/class/net/eth?/carrier)" == "1" ]; then
echo "$ETHERNET_ICON"
fi
fi
}
get_network
get_wifi