fix(network): don't show a saved SSID when Wi-Fi is disconnected on macOS#397
Open
ykworx wants to merge 1 commit into
Open
fix(network): don't show a saved SSID when Wi-Fi is disconnected on macOS#397ykworx wants to merge 1 commit into
ykworx wants to merge 1 commit into
Conversation
…acOS `scripts/network.sh` derives `wifi_network` from `networksetup -listpreferredwirelessnetworks`, which lists saved/preferred networks rather than the current association. When Wi-Fi is off but the host is online via Ethernet, `getairportnetwork` reports "not associated" and the module falls back to the first saved network, displaying a stale SSID (e.g. an old phone hotspot) the machine is not connected to. Gate the Wi-Fi branch on the interface actually being associated (`ifconfig "$ifname"` -> `status: active`) before consulting any SSID source. A not-associated interface now reports the Ethernet/Offline label. The dracula#370 connected-Wi-Fi SSID resolution is left untouched, so there is no regression for users currently on Wi-Fi. Fixes dracula#396 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ethancedwards8
requested changes
Jul 4, 2026
ethancedwards8
left a comment
Member
There was a problem hiding this comment.
Please read this before contributing: https://github.com/dracula/tmux/blob/master/CONTRIBUTING.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS,
scripts/network.shderives the candidate Wi-Fi name (wifi_network) from:listpreferredwirelessnetworkslists saved / preferred networks, not the current association. It is used as the fallback whengetairportnetworkreports "You are not associated with an AirPort network."So when Wi-Fi is off but the machine is online via Ethernet, the host ping passes,
getairportnetworkcorrectly returns "not associated", and the module falls back to the first saved network — showing a stale SSID (e.g. an old phone hotspot) the machine is not connected to.Closes #396.
Fix
Gate the Darwin Wi-Fi branch on the interface actually being associated, before consulting any SSID source:
ifconfig "$ifname"reportsstatus: activeonly when the interface is associated to an AP (inactivewhen Wi-Fi is off or unassociated). This signal stays readable even though the SSID itself is gated behind Location Services on macOS 15+.The existing #370 SSID resolution (
getairportnetwork+ thelistpreferredwirelessnetworks/ipconfigfallback) is left untouched, so there is no behavior change for users currently on Wi-Fi — only the not-associated case stops surfacing a saved name.Testing
macOS 26.3, Wi-Fi off + online via Ethernet:
Ethernet.bash -n scripts/network.shpasses.