wifi-select (705B)
1 #!/bin/sh 2 3 _connect() { 4 # Gets list of saved configurations. 5 _saved_nets=`nmcli -f NAME con show | grep -v "^NAME"` 6 7 # Gets available networks. 8 _ssids=`nmcli device wifi list | grep -v "^IN" | cut -c2- | awk '{print $2}' | grep -v "^--$"` 9 10 # Filter the available networks based on the saved ones, and send to rofi. 11 _ssid=`echo "$_saved_nets" | grep "$_ssids" | rofi -dmenu` 12 13 [ "$_ssid" = "" ] && exit 14 15 nmcli device wifi connect $_ssid >/dev/null 16 _notify_current 17 } 18 19 _notify_current() { 20 _current=`nmcli device status | grep "^wls3" | awk '{print $4}'` 21 notify-send "IEEE 802.11b-nettverk" "$_current" --urgency=low 22 } 23 24 [ "$1" = "-n" ] && _notify_current || _connect