Is there a way to turn Wi-Fi on/off using Spotlight?

Solution 1:

Not sure if this is the best method, but there's at least one way to set a keyword to trigger stuff in spotlight, and that is by making an application with Automator.

Personally I use Alfred for this type of stuff, but it's not overly difficult to do this with Automator.

  1. Open Automator.app
    • It should by default ask you what type of file to make, but if it doesn't ⌘ + N
  2. Choose a type for your document: Application
  3. Start writing: shell
  4. Press ↵ Enter twice
  5. It should now look something like this enter image description here
  6. Replace the cat text with: networksetup -setairportpower en0 off
  7. Save ( ⌘ + S )
  8. Name it: Wifi OFF.app

  9. Duplicate ( ⌘ + ⇧ + S )

  10. Rename to: Wifi ON
  11. In the networksetup -setairportpower en0 off text, replace the off with: on
  12. Save ( ⌘ + S )

Now if you open spotlight and write wifi, you should see something like this:

enter image description here




If you want to change the icons, here's an article explaining how in detail: http://osxdaily.com/2013/06/04/change-icon-mac/

Short version:

  1. Open the desired image in Preview.app (png works the best)
  2. Select all ( ⌘ + A )
  3. Copy ( ⌘ + C )
  4. Select the Wifi On.app in finder
  5. Go to file info: ( ⌘ + i )
  6. Click the current icon on the top left
  7. Paste ( ⌘ + V )

    After changing the icons, you might not see them change immediately. You can force spotlight to see the new icons faster by trashing the apps and then undoing it (taking files off the trast).

enter image description here

Links to the icons I used:

  • Wifi OFF
  • Wifi ON