aboutsummaryrefslogtreecommitdiff
path: root/i3blocks/i3internet.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-12-27 18:47:48 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-12-27 18:47:48 +0100
commitd165a641d16c181e6251737b9c86d6bf178370be (patch)
treeb9e20f0ac05633285630c857f0d5b1056d6a902d /i3blocks/i3internet.sh
parent82cd5e57e2ecb878396e4703ee2eb4cc0bba3c9e (diff)
downloadscripts-d165a641d16c181e6251737b9c86d6bf178370be.tar.gz
scripts-d165a641d16c181e6251737b9c86d6bf178370be.zip
jue dic 27 18:47:51 CET 2018
Diffstat (limited to 'i3blocks/i3internet.sh')
-rwxr-xr-xi3blocks/i3internet.sh34
1 files changed, 16 insertions, 18 deletions
diff --git a/i3blocks/i3internet.sh b/i3blocks/i3internet.sh
index 049a479..a148928 100755
--- a/i3blocks/i3internet.sh
+++ b/i3blocks/i3internet.sh
@@ -2,25 +2,23 @@
case $BLOCK_BUTTON in
1) i3-msg "exec urxvt -e nmtui" >/dev/null ;;
- 3) pgrep -x dunst >/dev/null && notify-send "<b>🌐 Internet module:</b>
-- Click for 'nmtui' for wifi access
-📡: no wifi connection
-📶: wifi connection with quality
-❎: no ethernet
-🌐: ethernet working
-" ;;
esac
-#
-#[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
-#
-#[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
-#
-#printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")"
wstatus=$(cat /sys/class/net/wlp2s0/operstate)
estatus=$(cat /sys/class/net/enp3s0/operstate)
-wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show wlp2s0 | grep "inet " | cut -d' ' -f6))"
-en=$(ip addr show enp3s0 | grep "inet " | cut -d' ' -f6)
-[ $wstatus = "down" ] && wifi="down"
-[ $estatus = "down" ] && en="down"
-echo "📶 $wifi | 🌐 $en"
+
+if [ $wstatus = "down" ]; then
+ wifi="❌"
+else
+ # with IP
+ #wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show wlp2s0 | grep "inet " | cut -d' ' -f6)) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))"
+ # no IP
+ wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)"%"}'))"
+fi
+if [ $estatus = "down" ]; then
+ en="❌"
+else
+ en=$(ip addr show enp3s0 | grep "inet " | cut -d' ' -f6)
+fi
+
+echo "📶$wifi 🌐$en"