Configuration file for dwm-bar on macbook air
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.

82 lines
2.4 KiB

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