dotfiles

my dotfiles.
Log | Files | Refs | README | LICENSE

internet.sh (675B)


      1 #!/bin/sh
      2 
      3 # Show wifi 📶 and percent strength or 📡 if none.
      4 # Show 🌐 if connected to ethernet or ❎ if none.
      5 
      6 case $BLOCK_BUTTON in
      7 	1) setsid "$TERMINAL" -e nmtui & ;;
      8 	3) notify-send "🌐 Internet module" "- Click to connect
      9 📡: no wifi connection
     10 📶: wifi connection with quality
     11 ❎: no ethernet
     12 🌐: ethernet working
     13 " ;;
     14 	6) "$TERMINAL" -e "$EDITOR" "$0" ;;
     15 esac
     16 
     17 case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
     18 	down) wifiicon="📡 " ;;
     19 	up) wifiicon="$(awk '/^s*w/ { print "📶", int($3 * 100 / 70) "%" }' /proc/net/wireless)" ;;
     20 esac
     21 
     22 printf "%s%sn" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)"