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

Patch to fix #290 #291

Merged
merged 3 commits into from
Oct 17, 2024
Merged

Patch to fix #290 #291

merged 3 commits into from
Oct 17, 2024

Conversation

jby
Copy link
Contributor

@jby jby commented Sep 17, 2024

Since Apple apparently has changed it's functionality

@ethancedwards8
Copy link
Member

I verified this on MacOS Ventura. I am several versions behind lol. One concern I have is that the command hangs. Can other users test this and provide feedback?

@jby
Copy link
Contributor Author

jby commented Sep 18, 2024

It doesn't hang, it takes a few seconds to complete

@ethancedwards8
Copy link
Member

It may just be my machine. I will test it on another one I have at home.

@Theoreticallyhugo
Copy link
Contributor

im running sonoma 14.6.1 on an m1 air 8gb and the command takes about 3.7s to complete.
however both commands seem to run fine on my machine, as soon as i fix the error with the misplaced )" in line 27.
Screenshot 2024-09-21 at 22 53 20

@jby
Copy link
Contributor Author

jby commented Sep 23, 2024

@Theoreticallyhugo - on macOS 14 Sonoma the networksetup -getairportnetwork does work, but not on macOS 15 Sequoia, it just answers:

time networksetup -getairportnetwork en0
You are not associated with an AirPort network.
user=0.01s system=0.01s cpu=45% total=0.036

And you'll get that string in your tmux statusbar, which is not that useful.
Hence the need for a different solution in Sequoia

@Theoreticallyhugo
Copy link
Contributor

i see the issue, however im curious. does system profiler also have the significant delay on sequoia?
i would think that making an OS check and using the faster command based on that may be an idea.

@jby
Copy link
Contributor Author

jby commented Sep 26, 2024

i see the issue, however im curious. does system profiler also have the significant delay on sequoia? i would think that making an OS check and using the faster command based on that may be an idea.

A complete system_profiler run on Sequoia (and on my M3 Pro MBP) takes 12,80 seconds
If run for only SPAirPortDataType system_profiler SPAirPortDataType it takes 0,09 seconds

@dot-1q
Copy link

dot-1q commented Sep 27, 2024

If I may chime in, system_profiler SPAirPortDataType takes roughly 3 seconds on my machine (MBA M2) running Sequoia, which is just too much.
I wonder if we can achieve the same behavior via another command.
From my very limited testing, networksetup -listpreferredwirelessnetworks en0 seems to output the connected Wifi's SSID at the top of the list. It would then be a matter of formatting the output. If others can also replicate this behavior, it could be worth pursuing this route.

EDIT:
Found that ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}' also works.
Credit: FelixKratz/SketchyBar#616 (comment)

@Theoreticallyhugo
Copy link
Contributor

@dot-1q s ipconfig based command works very quickly on Sonoma. if that also works on Sequoia, i'd say that it's the command to go with.

@litszwaiboris
Copy link

If I may chime in, system_profiler SPAirPortDataType takes roughly 3 seconds on my machine (MBA M2) running Sequoia, which is just too much. I wonder if we can achieve the same behavior via another command. From my very limited testing, networksetup -listpreferredwirelessnetworks en0 seems to output the connected Wifi's SSID at the top of the list. It would then be a matter of formatting the output. If others can also replicate this behavior, it could be worth pursuing this route.

EDIT: Found that ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}' also works. Credit: FelixKratz/SketchyBar#616 (comment)

yay its my issue

@jby
Copy link
Contributor Author

jby commented Oct 6, 2024

The system_profiler way (the one in my patch) works for both macOS14 and macOS15 whereas the ipconfig getsummary en0 only works on macOS15...

@Theoreticallyhugo
Copy link
Contributor

@jby I'm running Sonoma 14.6.1 and ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}' gets the right output very quickly

@dot-1q
Copy link

dot-1q commented Oct 7, 2024

The system_profiler way (the one in my patch) works for both macOS14 and macOS15 whereas the ipconfig getsummary en0 only works on macOS15...

The ipconfig command comes with macOS by default if im not mistaken, so it works with both macOS14 & 15

@jby
Copy link
Contributor Author

jby commented Oct 7, 2024

@jby I'm running Sonoma 14.6.1 and ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}' gets the right output very quickly

Ok

@ethancedwards8
Copy link
Member

ethancedwards8 commented Oct 15, 2024

@dot-1q s ipconfig based command works very quickly on Sonoma. if that also works on Sequoia, i'd say that it's the command to go with.

I agree. It also works quickly for me on 13.4 (Ventura). @jby , if you would like to edit the PR to use that command, I'll get it merged ASAP. Thank you everyone!

@jby
Copy link
Contributor Author

jby commented Oct 16, 2024

@ethancedwards8 - updated!

@ethancedwards8 ethancedwards8 merged commit 2a9c6e9 into dracula:master Oct 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants