Highlights
- Zero-configuration setup: network interfaces are now discovered automatically; editing
ETHERNET_REGEXorWIFI_REGEXis no longer required. - Multiple wired adapters: Wi-Fi is disabled when any detected Ethernet, dock, or Thunderbolt
eninterface is active. - Correct Wi-Fi power detection: the script checks radio power directly instead of confusing an unassociated Wi-Fi connection with a powered-off radio.
- Respect for manual Wi-Fi choices: Wi-Fi is restored only when this script previously disabled it.
- Seamless upgrades: legacy launchd services and their Wi-Fi state are detected and migrated automatically.
UX and reliability
- Added
wifi-toggle.sh statusto show launchd state, the installed script and service version, detected interfaces, Wi-Fi power, wired link state, and pending restoration. - Made
wifi-toggle.sh onsafely update and reload an existing service;offis also idempotent and restores Wi-Fi when appropriate. - Added clear root-user detection and corrected command help and exit statuses.
- Propagated interface, Wi-Fi power, and launchctl failures instead of reporting false success.
- Notifications are now sent only after successful Wi-Fi changes.
- launchd plists are generated privately, XML-escaped, validated with
plutil, and installed atomically. - The script is now executable in the repository.
- Expanded installation, upgrade, usage, and troubleshooting documentation.
Upgrading from v1
-
Copy the new
wifi-toggle.shover the old script and ensure it remains executable:chmod 755 /path/to/wifi-toggle.sh
-
Run the new script's
oncommand to validate, version, and reload the installed service:/path/to/wifi-toggle.sh on
You do not need to run the old version's off command first. If the script is replaced at the same path, launchd will use the new code on its next invocation; running on is still recommended.
Full changelog: v1...v2