44

Under Keyboard Shortcuts : Application Shortcuts I've already tried with either "Search With Google" or "Google Search..." as the Menu Item (both of these for Application set as Google Chrome, of course).

Also, even with Chrome as the default browser, the Search With Google (under Services : Searching; which works) always uses Safari.

In short, how do you set up a keyboard shortcut to avoid right-clicking the selected word and choosing Search Google for 'the selected word' from the right-click menu?

Thank you.

Blaz
  • 783

3 Answers3

57

The Search With Google service is provided by Safari, and it is not meant to work with other browsers.

You can create another service yourself though:

  1. Open Automator and choose the Service template
  2. Add a Run Shell Script action for a script like open "http://www.google.com/search?q=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp')"
  3. Save the service and assign it a shortcut from System Preferences

Lri
  • 42,502
  • 8
  • 126
  • 159
12

Nowadays you can also use "Run Javascript" in automator services, and stack it with "Internet" → "Open webpages". Something like this:

JavaScript to run:

function run(input, parameters) {
   return "https://www.google.com/search?q=" + encodeURI(input)
}

Screenshot of Automator "service":
screenshot of Automator "service"

codesnik
  • 221
7

Just wanted to add that if you use accepted answer and save the service as "Search with Google", it will be executed instead of the service of the same name that launches Safari.

DrStrangepork
  • 1,855
  • 1
  • 13
  • 12