rofi-wifi-menu
rofi-wifi-menu copied to clipboard
Empty password string
Hello there.
Whenever I press enter when prompted for the wifi password, the WIFIPASS variable preserves the string "if connection is stored, hit enter", since there's no checking if the string is empty or not. This happens in the use case that a connection is saved in the system and when the password isn't typed in a new connection.
Fix incoming senor zbaylin
Modify From:
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
fi
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
To:
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
fi
if [[ $WIFIPASS == *"if connection is stored"* ]]; then
nmcli dev wifi con "$CHSSID"
else
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
fi
Sovle the Empty password string
In my case, removing the whole password handeling solved the issue:
else
# If the connection is already in use, then this will still be able to get the SSID
if [ "$CHSSID" = "*" ]; then
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
fi
# nmcli con up "$CHSSID"
nmcli dev wifi con "$CHSSID"
fi
fi