dotfiles/.local/bin/wlp
2025-06-20 04:36:33 +00:00

17 lines
367 B
Bash
Executable File

#!/bin/bash -eu
iwctl=(iwctl station "$(find /sys/class/net/wlan* -printf '%f' -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
touch "$XDG_RUNTIME_DIR/sbar/net"
exit 0
fi
sleep 1
done