aboutsummaryrefslogtreecommitdiff
path: root/modules/wifi
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-10-21 20:22:57 +0100
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-10-21 20:22:57 +0100
commit69c852b4a5f65ee2c4fcd3dadac6940edc50a780 (patch)
tree9d731671fbde0d4184a5239751a659ec44429913 /modules/wifi
parentb4cd124c6c62d88535ca8df5ac8ea30d3702c4f9 (diff)
Added ethernet module
Diffstat (limited to 'modules/wifi')
-rwxr-xr-xmodules/wifi23
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/wifi b/modules/wifi
new file mode 100755
index 0000000..ebe30f9
--- /dev/null
+++ b/modules/wifi
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Gets the wifi status
+
+WIFI_FULL_ICON=''
+WIFI_MID_ICON=''
+WIFI_LOW_ICON=''
+
+get_wifi()
+{
+ if grep -q wlan* "/proc/net/wireless"; then
+ # Wifi quality percentage
+ percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
+ case $percentage in
+ 100|9[0-9]|8[0-9]|7[0-9]) echo "$WIFI_FULL_ICON" ;;
+ 6[0-9]|5[0-9]|4[0-9]|3[0-9]) echo "$WIFI_MID_ICON" ;;
+ 2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;;
+ esac
+ fi
+}
+
+get_wifi
+