scripts

scripts to make my pc work
Index Commits Files Refs
statusbar/sb-internet_colored (1064B)
   1 #!/bin/sh
   2 
   3 # Prints your local ip address, if you are connected both via wireless & ethernet then the ethernet ip is printed
   4 
   5 # by github.com/klewer-martin
   6 
   7 estatus="$(cat /sys/class/net/e*/operstate)"
   8 espeed="$(cat /sys/class/net/e*/speed)"
   9 
  10 wstatus="$(cat /sys/class/net/w*/operstate)"
  11 wspeed=$(cat /proc/net/wireless | awk '/wlp*/ { $3=substr($3, 0, length($3) - 1); print $3 }')
  12 
  13 if [ "$estatus" = "down" ]; 
  14     then if [ "$wstatus" = "down" ]
  15         then ip="^c#FF2A2A^Disconnected^d^"; icon="🌐"
  16         else case $wstatus in
  17                 [0-2][0-9])
  18                     ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="📡";;
  19                 [2-4][0-9])
  20                     ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="📡";;
  21                 [5-7][0-9])
  22                     ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="📡";;
  23             esac
  24         fi;
  25     else ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="🌐";
  26 fi;
  27 
  28 printf "%s^c#00FF00^ %s^d^\n" "$icon" "$ip"