Updated scripts.

This commit is contained in:
cronyakatsuki 2022-04-22 12:48:51 +02:00
parent 272fb806ef
commit 8364d66ca5
7 changed files with 22 additions and 60 deletions

View file

@ -12,9 +12,9 @@ elif [[ "$connected" =~ "disabled" ]]; then
fi
# Use dmenu to select wifi network
chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | dmenu -p "Wi-Fi SSID: " )
chosen_network=$(printf '%s\n%s' "$toggle" "$wifi_list" | uniq -u | dmenu -p "Wi-Fi SSID: " )
# Get name of connection
chosen_id=$(echo "${chosen_network:3}" | xargs)
chosen_id=$(printf '%s\n' "${chosen_network:3}" | xargs)
if [ "$chosen_network" = "" ]; then
exit
@ -27,7 +27,7 @@ else
success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
# Get saved connections
saved_connections=$(nmcli -g NAME connection)
if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
if [[ $(printf '%s\n' "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
nmcli connection up id "$chosen_id" | grep "successfully" && quick-notify "Connection Established" "$success_message"
else
if [[ "$chosen_network" =~ "" ]]; then