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

Bug: Error obtaining wireless information on desktop Macs #264

Open
moussaclarke opened this issue May 12, 2024 · 6 comments
Open

Bug: Error obtaining wireless information on desktop Macs #264

moussaclarke opened this issue May 12, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@moussaclarke
Copy link

moussaclarke commented May 12, 2024

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:

  1. On a desktop mac connected to WiFi, add the network plugin
  2. Open tmux
  3. Look at the status line

Expected behavior

Status line should show the network SSID

Screenshots

Screenshot 2024-05-12 at 10 38 45

System

  • OS: mac OS X 14.4.1
  • Tmux Version: 3.4
@moussaclarke moussaclarke added the bug Something isn't working label May 12, 2024
@moussaclarke
Copy link
Author

Possibly related:
#259
#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"}')

moussaclarke added a commit to moussaclarke/dracula-tmux that referenced this issue May 12, 2024
@moussaclarke
Copy link
Author

This fixes it for me moussaclarke@970eab2

Can submit as PR if appropriate.

@oiavorskyi
Copy link

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.

@moussaclarke
Copy link
Author

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

@moussaclarke
Copy link
Author

@oiavorskyi updated: moussaclarke@9770d37

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.

@oiavorskyi
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants