From 69c852b4a5f65ee2c4fcd3dadac6940edc50a780 Mon Sep 17 00:00:00 2001 From: Manuel Palenzuela Date: Mon, 21 Oct 2019 20:22:57 +0100 Subject: [PATCH] Added ethernet module --- modules/ethernet | 16 ++++++++++++++++ modules/{network => wifi} | 13 +++---------- 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100755 modules/ethernet rename modules/{network => wifi} (69%) diff --git a/modules/ethernet b/modules/ethernet new file mode 100755 index 0000000..0ebe572 --- /dev/null +++ b/modules/ethernet @@ -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 diff --git a/modules/network b/modules/wifi similarity index 69% rename from modules/network rename to modules/wifi index 1507ad6..ebe30f9 100755 --- a/modules/network +++ b/modules/wifi @@ -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