aboutsummaryrefslogtreecommitdiffstats
path: root/modules/wifi
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-02-26 20:31:12 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-02-26 20:31:12 +0530
commit85ae438fbc238fe56bcb1c10a12ec52365053cb6 (patch)
tree7aa2c802739657f22fd8de735207b27fc6e7e8a9 /modules/wifi
downloaddwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.gz
dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.bz2
dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.zip
dwmbar dotfiles
Diffstat (limited to 'modules/wifi')
-rwxr-xr-xmodules/wifi24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/wifi b/modules/wifi
new file mode 100755
index 0000000..4f56b5a
--- /dev/null
+++ b/modules/wifi
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Gets the wifi status
+
+WIFI_FULL_ICON=''
+WIFI_MID_ICON=''
+WIFI_LOW_ICON=''
+NO_WIFI_ICON=''
+
+get_wifi()
+{
+ if grep -q wl* "/proc/net/wireless"; then
+ # Wifi quality percentage
+ percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
+ case $percentage in
+ 0) echo $NO_WIFI_ICON;;
+ 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