See & Toggle Wi-Fi and VPN Status with one button
- If Wi-Fi is off, the button says "Wi-Fi" (in red)
- If Wi-Fi is on, and VPN is connected, the button says the Wi-Fi SSID (in green)
- If Wi-Fi is on, but VPN is disconnected, the button says the Wi-Fi SSID (in red)
Tap button once to toggle Wi-Fi
Long-tap button to toggle VPN
Installation & Configuration
1. Allow Scripting & Configure Shared Secret
If your BetterTouchTool is configured to use a shared secret, get it from the advanced settings dialog (see here, chapter "security"). If the shared secret field is empty, you can ignore the shared secret altogether and do not need to change this part of the scripts. If you would like to use one, or if it's already configured with other plugins, copy the shared secret to your clipboard.
The script tries to figure out your Wi-Fi network adapter's BSD name (like en0, en1, etc.) to toggle it.
It doesn't matter what kind of VPN you have, as long as you configured it directly through macOS's System Preferences (Network option) and as long as they start with "VPN " (e.g. "VPN USA", "VPN MyCompany"). The script to toggle VPN is configured in BetterTouchTool's "Other"-Tab.
This script finds all VPN connections and sorts them alphabetically. That means, that if you have 2 VPN networks, let's say "VPN 1 MyCompany" and "VPN 2 MyCompany", the alphabetically first one will be the default one it auto-connects to.
Known limitation: if your VPN is not a L2TP one, please adjust the word it searches for in the Touchbar-button and toggle vpn script. (I only have this kind, so I don't know exactly what other values could show up. If you have such a case, let me know and I'll implement it9o
The auto-connect dialog and the three different states of the touchbar button (My Wi-Fi SSID starts with "Sunrise_"