Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac: Fix network detection #303

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions scripts/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ get_ssid()
;;

Darwin)
if ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}'; then
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
echo "$wifi_label$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')"
local wifi_network=$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')
local airport=$(networksetup -getairportnetwork en0 | cut -d ':' -f 2)

if [[ $airport != "You are not associated with an AirPort network." ]]; then
echo "$wifi_label$airport" | sed 's/^[[:blank:]]*//g'
elif [[ $wifi_network != "" ]]; then
echo "$wifi_label$wifi_network" | sed 's/^[[:blank:]]*//g'
else
echo "$ethernet_label"
fi
Expand Down