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.

56 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. # echo $INTERFACE
  16. #------------------------------------------------------------------------
  17. # As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
  18. # connection (think desktop), the corresponding block should not be displayed.
  19. # [[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
  20. # [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
  21. #------------------------------------------------------------------------
  22. QUALITY=$(sudo grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
  23. # echo $QUALITY
  24. W_inter=$(ip link | grep "[1-9]: wlp" | cut -d " " -f2 | tr -d ':')
  25. # W_name=$(nmcli d | grep "$W_inter" | awk '{print $4}')
  26. #------------------------------------------------------------------------
  27. echo $QUALITY% # full text
  28. echo $QUALITY% # short text
  29. . "/home/kevin/.cache/wal/colors.sh"
  30. # color
  31. if [[ $QUALITY -lt 50 ]]; then
  32. echo "#FF0000"
  33. else
  34. echo "$color7"
  35. fi
  36. # if [[ $QUALITY -ge 80 ]]; then
  37. # echo "#00FF00"
  38. # elif [[ $QUALITY -lt 80 ]]; then
  39. # echo "#FFF600"
  40. # elif [[ $QUALITY -lt 60 ]]; then
  41. # echo "#FFAE00"
  42. # elif [[ $QUALITY -lt 40 ]]; then
  43. # echo "#FF0000"
  44. # fi