[wifi_dmenu.sh]: add notification of result of connection attempt

This commit is contained in:
2024-08-17 23:00:45 +01:00
parent df5bc22cda
commit 344ffcb005

View File

@ -1,7 +1,8 @@
#!/bin/sh
# Script to connect to an available WiFi network with a dmenu prompt.
notify-send "$(basename "$0")" "Scanning for available networks..."
script_name="$(basename "$0")"
notify-send "$script_name" "Scanning for available networks..."
# cutting the first 9 characters of the nmcli output as it will contain empty fields which will mess up awk parsing
$(nmcli connection up $( nmcli device wifi list | cut --characters=9- | awk '(NR > 1){ print $2}' | sort | uniq | dmenu -p "Connect to network: "))
notify-send "$script_name" "$(nmcli connection up $( nmcli device wifi list | cut --characters=9- | awk '(NR > 1){ print $2}' | sort | uniq | dmenu -p "Connect to network: "))"