Open moussaclarke opened 5 months ago
Possibly related: https://github.com/dracula/tmux/pull/259 https://github.com/dracula/tmux/issues/256
I think what's going on is that en1
is wifi on desktop macs, not en0
, so probably need to check which interface is active before calling networksetup
e.g. active=$(ifconfig | awk '/en0/ && /inet/ {print "en0"} /en1/ && /inet/ {print "en1"}')
This fixes it for me https://github.com/moussaclarke/dracula-tmux/commit/970eab249c55288a7a5b2b2804d2861c81a7b68f
Can submit as PR if appropriate.
This fix does not work in the scenario where wither wired or both wireless and wired connections are used. Command networksetup -getairportnetwork $interface | cut -d ':' -f 2 | sed 's/^[[:blank:]]*//g'
responses with
en0 is not a Wi-Fi interface.
Error obtaining wireless information.
Ok I guess we could fall back to Ethernet
if we get that response from networksetup -getairportnetwork
on the active interface.
Otherwise when I get a minute I'll see if I can figure out a less indirect way of checking the type of connection before calling networksetup -getairportnetwork
- probably via ifconfig
again
@oiavorskyi updated: https://github.com/moussaclarke/dracula-tmux/commit/9770d3752584a1609045a6bf1f7af92f37cb16fb
I couldn't find a straightforward way to get the connection type, so just checking for the presence of the error message string. Feels somewhat brittle though? Also added a "No connection" status
Will test it on a wired connection when I get the chance.
@moussaclarke sorry for not responding in a very long time, I was on a vacation. Maybe it is possible to use the result of
networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}'
to check which interface(s) are WiFi ones and then see if it is used a an active interface?
Describe the bug
On desktop Macs, e.g. a macMini, the network shows as "Error obtaining Wireless information"
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Status line should show the network SSID
Screenshots
System