Dotfiles for my tiling window manager + terminal workflow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB

  1. #!/bin/bash
  2. # Copyright (C) 2014 Alexander Keller <github@nycroth.com>
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. #------------------------------------------------------------------------
  14. INTERFACE="${BLOCK_INSTANCE:-wlan0}"
  15. #------------------------------------------------------------------------
  16. # As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
  17. # connection (think desktop), the corresponding block should not be displayed.
  18. # [[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
  19. # [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
  20. #------------------------------------------------------------------------
  21. QUALITY=$(sudo grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
  22. W_inter=$(ip link | grep "[1-9]: wlp" | cut -d " " -f2 | tr -d ':')
  23. W_name=$(nmcli d | grep "$W_inter" | awk '{print $4}')
  24. #------------------------------------------------------------------------
  25. # echo $QUALITY% "$W_name" # full text
  26. # echo $QUALITY% # short text
  27. . "/home/kevin/.cache/wal/colors.sh"
  28. printf "%s%%\n\n%s\n" $QUALITY $color7
  29. # color
  30. # if [[ $QUALITY -ge 80 ]]; then
  31. # echo "#00FF00"
  32. # elif [[ $QUALITY -lt 80 ]]; then
  33. # echo "#FFF600"
  34. # elif [[ $QUALITY -lt 60 ]]; then
  35. # echo "#FFAE00"
  36. # elif [[ $QUALITY -lt 40 ]]; then
  37. # echo "#FF0000"
  38. # fi