summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-12-03 01:02:31 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-12-03 01:02:31 +0100
commitb31f48d09f786af5c1a3eb8bfb52cfb0490bda28 (patch)
tree42375d84539384b15ce8ecfa6accfd19453274c9 /wifi
parente2219fed326e3a1e7b51f874cd3875d21ea869b7 (diff)
downloadstatus_blocks-b31f48d09f786af5c1a3eb8bfb52cfb0490bda28.tar.gz
status_blocks-b31f48d09f786af5c1a3eb8bfb52cfb0490bda28.tar.bz2
status_blocks-b31f48d09f786af5c1a3eb8bfb52cfb0490bda28.zip
init comit
Diffstat (limited to 'wifi')
-rwxr-xr-xwifi15
1 files changed, 15 insertions, 0 deletions
diff --git a/wifi b/wifi
new file mode 100755
index 0000000..aacc3b8
--- /dev/null
+++ b/wifi
@@ -0,0 +1,15 @@
+#!/bin/sh
+case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
+ down)
+ echo "\004 \001"
+ ;;
+ up)
+ ssid="$(iw dev | grep ssid | awk '{print $2}')"
+ percent="$(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)"
+ wifiicon=" "
+ [ $percent -le 50 ] && [ $percent -gt 25 ] && color=$(echo '\003') || color=''
+ [ $percent -le 25 ] && color=$(echo '\004')
+ printf "%s%s%s%s\001" "$wifiicon" "$ssid " $color "($percent%)"
+ ;;
+esac
+