diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 20:22:57 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-21 20:22:57 +0100 |
commit | 69c852b4a5f65ee2c4fcd3dadac6940edc50a780 (patch) | |
tree | 9d731671fbde0d4184a5239751a659ec44429913 /modules | |
parent | b4cd124c6c62d88535ca8df5ac8ea30d3702c4f9 (diff) |
Added ethernet module
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/ethernet | 16 | ||||
-rwxr-xr-x | modules/wifi (renamed from modules/network) | 13 |
2 files changed, 19 insertions, 10 deletions
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 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 |