Add an explicit "None" choice while adding wpa network passphrase

And refactorise those menu choices computing…

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
This commit is contained in:
Willow Barraco
2023-02-06 10:14:39 +01:00
committed by Peter John Hartman
parent f8c9138739
commit db0cbac8ab

View File

@@ -130,19 +130,21 @@ addnetworkgsmmenu() {
} }
addnetworkwpamenu() { addnetworkwpamenu() {
SSID="$( SSID="$(cat <<EOF | sxmo_dmenu_with_kb.sh -p "SSID"
nmcli d wifi list | tail -n +2 | grep -v '^\*' | awk -F' ' '{ print $6 }' | grep -v '\-\-' | $icon_cls Close Menu
xargs -0 printf "$icon_cls Close Menu\n%s" | $(nmcli d wifi list | tail -n +2 | grep -v '^\*' | awk -F' ' '{ print $6 }' | grep -v '\-\-')
sxmo_dmenu_with_kb.sh -p "SSID" EOF
)" )"
[ -z "$SSID" ] && return [ -z "$SSID" ] && return
echo "$SSID" | grep -q "Close Menu" && return echo "$SSID" | grep -q "Close Menu" && return
PASSPHRASE="$( PASSPHRASE="$(cat <<EOF | sxmo_dmenu_with_kb.sh -p "Passphrase"
echo "$icon_cls Close Menu" | $icon_cls Close Menu
sxmo_dmenu_with_kb.sh -p "Passphrase" None
EOF
)" )"
if [ -z "$PASSPHRASE" ]; then
if [ -z "$PASSPHRASE" ] || [ "None" = "$PASSPHRASE" ]; then
unset PASSPHRASE unset PASSPHRASE
fi fi
echo "$PASSPHRASE" | grep -q "Close Menu" && return echo "$PASSPHRASE" | grep -q "Close Menu" && return