Browse Source

Merge pull request #2 from LuchianMihai/add-dwm_wpa

add dwm_wpa.sh
patch-fontkeys
Joe Standring 4 years ago
committed by GitHub
parent
commit
edf38eadbc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 80 additions and 0 deletions
  1. +80
    -0
      bar-functions/dwm_wpa.sh

+ 80
- 0
bar-functions/dwm_wpa.sh View File

@ -0,0 +1,80 @@
#!/bin/mksh
dwm_wpa() {
CONSTATE=$(wpa_cli status | sed -n '/wpa_state/s/^.*=//p')
case $CONSTATE in
'COMPLETED')
CONSSID=$(wpa_cli status | sed -n '/\<ssid\>/s/^.*=//p')
CONIP=$(wpa_cli status | sed -n '/ip_address/s/^.*=//p')
CONRSSI=$(wpa_cli signal_poll | sed -n '/AVG_RSSI/s/^.*=//p')
if [ "$CONRSSI" -gt -35 ]; then
printf "%s" "$SEP1"
printf "\uF927 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
elif [ "$CONRSSI" -ge -55 ] && [ "$CONRSSI" -lt -35 ]; then
printf "%s" "$SEP1"
printf "\uF924 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
elif [ "$CONRSSI" -ge -75 ] && [ "$CONRSSI" -lt -55 ]; then
printf "%s" "$SEP1"
printf "\uF921 %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
else
printf "%s" "$SEP1"
printf "\uF91E %s %s" "$CONSSID" "$CONIP"
printf "%s\n" "$SEP2"
fi
;;
#======================================================================#
'DISCONNECTED')
printf "%s" "$SEP1"
printf "\uF92D %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'INTERFACE_DISABLED')
printf "%s" "$SEP1"
printf "\uF92D %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
#======================================================================#
'SCANNING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'ASSOCIATING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'ASSOCIATED')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'AUTHENTICATING')
printf "%s" "$SEP1"
printf "\uF92A %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
#======================================================================#
'4WAY_HANDSHAKE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'GROUP_HANDSHAKE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
'INACTIVE')
printf "%s" "$SEP1"
printf "\uF92B %s" "$CONSTATE"
printf "%s\n" "$SEP2"
;;
esac
}
dwm_wpa

Loading…
Cancel
Save