dotfiles/.local/bin/wlp
2025-02-17 06:08:25 +00:00

17 lines
371 B
Bash
Executable File

#!/bin/bash -e
iwctl=(iwctl station "$(find /sys/class/net/wlan* -print -quit)")
rfkill unblock wlan
if ! "${iwctl[@]}" show | grep -q 'Scanning\s\+yes'; then
"${iwctl[@]}" scan
fi
for _ in {0..29}; do
if "${iwctl[@]}" show | grep -q '\s*State\s\+connected\s*$'; then
kill -37 "$(cat "$XDG_CACHE_HOME/pidofbar")"
exit 0
fi
sleep 1
done