#!/bin/sh

# Sending Notification With dunst :
notify-send "listing available Wi-Fi networks..."

status=$(nmcli -fields WIFI g)
if [[ "$status" =~ "enabled" ]]; then
	toggle="睊  Disable Wi-Fi"
elif [[ "$status" =~ "disabled" ]]; then
	toggle="直  Enable Wi-Fi"
fi


bssid=$(nmcli  device wifi list | sed -n '1!p' | cut -b 9- | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/  //g" | sed "/--/d"| dmenu -i -l 20 -h 25 -p "Select Wifi 直:" | cut -d' ' -f1)

pass=$(echo"" | dmenu -l 20 -h 30 -i -p "Enter the password :")

nmcli device wifi connect $bssid password $pass
