Q: How to turn Wi-Fi on / off with a shortcut
I would like to be able to turn Wi-Fi on and off with a shortcut (Control-W or something like that).
I have tried to enable this on the Shortcuts part of the Keyboard Preferences, but with no luck.
App Shortcuts / All Applications / Turn Wi-Fi On - does not work.
Is there a way to do this?
iMac, OS X Mavericks (10.9)
Posted on Jul 19, 2014 12:17 AM
Here is a way to do it.
Create an Automator Service that looks like the following:
The code in the Run Shell Script action is this:
if [[ `networksetup -getairportpower en1` == *On ]] then networksetup -setairportpower en1 off else networksetup -setairportpower en1 on fi
Save the Service with a short name like, “ToggleWiFi"
Then, open Keyboard System Preferences and add a Shortcut to the new Service you created.
To create the service, open Automator and create a New Service.
Set it to Service receives no input in any application
Drag in a Run Shell Script action from the Utilities library.
Copy and paste the above code into the action, replacing “cat"
Save the Service.
Open Keyboard System Prefs
Click on Shortcuts Tab.
Select Services from the category list.
Scroll down and find your Service and set the shortcut.
Posted on Jul 19, 2014 7:57 AM

