Skip to content

Instantly share code, notes, and snippets.

@salkin-mada
Last active December 1, 2020 03:27
Show Gist options
  • Save salkin-mada/6a47d226e4990869ac1b369dbc4a186a to your computer and use it in GitHub Desktop.
Save salkin-mada/6a47d226e4990869ac1b369dbc4a186a to your computer and use it in GitHub Desktop.
skim iwctl func
function wif() {
local device=$(iwctl device list | awk '{print $1}' | rg w)
echo "using device: $device"
local cmd="iwctl station $device get-networks"
local pcmd="iwctl station $device show"
echo "scanning for networks"
iwctl station $device scan && iwctl station $device connect \
$(sk --ansi -c $cmd --preview $pcmd \
--bind 'enter:execute(echo {} | awk '"'"'{print $1}'"'"')+abort' \
--bind 'esc:execute(echo "user_closed_wif")+abort' \
--bind 'ctrl-c:execute(echo "user_closed_wif")+abort'
)
}
# for hidden AP's
function wifh() {
local device=$(iwctl device list | awk '{print $1}' | rg w)
echo "using device: $device"
local cmd="iwctl station $device get-hidden-access-points"
local pcmd="iwctl station $device show"
echo "scanning for networks"
iwctl station $device scan && iwctl station $device connect-hidden \
$(sk --ansi -c $cmd --preview $pcmd \
--bind 'enter:execute(echo {} | awk '"'"'{print $1}'"'"')+abort' \
--bind 'esc:execute(echo "user_closed_wif")+abort' \
--bind 'ctrl-c:execute(echo "user_closed_wif")+abort'
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment