dwm-bar for archlinux
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.

80 lines
2.4 KiB

  1. #!/bin/mksh
  2. dwm_wpa() {
  3. CONSTATE=$(wpa_cli status | sed -n '/wpa_state/s/^.*=//p')
  4. case $CONSTATE in
  5. 'COMPLETED')
  6. CONSSID=$(wpa_cli status | sed -n '/\<ssid\>/s/^.*=//p')
  7. CONIP=$(wpa_cli status | sed -n '/ip_address/s/^.*=//p')
  8. CONRSSI=$(wpa_cli signal_poll | sed -n '/AVG_RSSI/s/^.*=//p')
  9. if [ "$CONRSSI" -gt -35 ]; then
  10. printf "%s" "$SEP1"
  11. printf "\uF927 %s %s" "$CONSSID" "$CONIP"
  12. printf "%s\n" "$SEP2"
  13. elif [ "$CONRSSI" -ge -55 ] && [ "$CONRSSI" -lt -35 ]; then
  14. printf "%s" "$SEP1"
  15. printf "\uF924 %s %s" "$CONSSID" "$CONIP"
  16. printf "%s\n" "$SEP2"
  17. elif [ "$CONRSSI" -ge -75 ] && [ "$CONRSSI" -lt -55 ]; then
  18. printf "%s" "$SEP1"
  19. printf "\uF921 %s %s" "$CONSSID" "$CONIP"
  20. printf "%s\n" "$SEP2"
  21. else
  22. printf "%s" "$SEP1"
  23. printf "\uF91E %s %s" "$CONSSID" "$CONIP"
  24. printf "%s\n" "$SEP2"
  25. fi
  26. ;;
  27. #======================================================================#
  28. 'DISCONNECTED')
  29. printf "%s" "$SEP1"
  30. printf "\uF92D %s" "$CONSTATE"
  31. printf "%s\n" "$SEP2"
  32. ;;
  33. 'INTERFACE_DISABLED')
  34. printf "%s" "$SEP1"
  35. printf "\uF92D %s" "$CONSTATE"
  36. printf "%s\n" "$SEP2"
  37. ;;
  38. #======================================================================#
  39. 'SCANNING')
  40. printf "%s" "$SEP1"
  41. printf "\uF92A %s" "$CONSTATE"
  42. printf "%s\n" "$SEP2"
  43. ;;
  44. 'ASSOCIATING')
  45. printf "%s" "$SEP1"
  46. printf "\uF92A %s" "$CONSTATE"
  47. printf "%s\n" "$SEP2"
  48. ;;
  49. 'ASSOCIATED')
  50. printf "%s" "$SEP1"
  51. printf "\uF92A %s" "$CONSTATE"
  52. printf "%s\n" "$SEP2"
  53. ;;
  54. 'AUTHENTICATING')
  55. printf "%s" "$SEP1"
  56. printf "\uF92A %s" "$CONSTATE"
  57. printf "%s\n" "$SEP2"
  58. ;;
  59. #======================================================================#
  60. '4WAY_HANDSHAKE')
  61. printf "%s" "$SEP1"
  62. printf "\uF92B %s" "$CONSTATE"
  63. printf "%s\n" "$SEP2"
  64. ;;
  65. 'GROUP_HANDSHAKE')
  66. printf "%s" "$SEP1"
  67. printf "\uF92B %s" "$CONSTATE"
  68. printf "%s\n" "$SEP2"
  69. ;;
  70. 'INACTIVE')
  71. printf "%s" "$SEP1"
  72. printf "\uF92B %s" "$CONSTATE"
  73. printf "%s\n" "$SEP2"
  74. ;;
  75. esac
  76. }
  77. dwm_wpa