Skip to content

Commit

Permalink
Merge pull request #303 from fvincenzo/master
Browse files Browse the repository at this point in the history
mac: Fix network detection
  • Loading branch information
ethancedwards8 authored Oct 18, 2024
2 parents 2a9c6e9 + 499aef3 commit 3f892b2
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit 3f892b2

Please sign in to comment.