This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/scripts/bin/wifi-list
2017-04-27 17:22:57 -05:00

15 lines
634 B
Bash
Executable file

#!/usr/bin/env bash
# wip
SSID=$(nmcli device wifi | tail -n +2 | "$DOTFILES_PATH/scripts/bin/app-launcher" -i --display-mode "wifi" -p "wifi:" -dmenu -width 50 | sed -re 's/^\s*\*//' | awk '{print $1}')
RESULT=$(nmcli device wifi connect "$SSID")
if echo "$RESULT" | grep -q -E '^Error: Connection activation failed: \(7\)'; then
# TODO: currently, the first attempt to connect fails and then we wait for
# a rescan before trying again
sleep 10
PASSWORD=$(: | "$DOTFILES_PATH/scripts/bin/app-launcher" --display-mode "Password:" -dmenu -p "wifi_password:" -width 50)
nmcli device wifi connect "$SSID" password "$PASSWORD"
fi