How do I change the Services sub component to not use Safari web browser
When I right click and use the "Search Google for" different things happen. For one, if I am in Chrome it opens a new tab in Chrome and searches as I want. However, if I use this menu anywhere else in macOS, it uses Safari.
The system itself has the Services sub-component listed under Keyboard preferences or under the Finder menus. The Services sub-component lists lots of right-click menu items but does not let me change them. It lists "Search Google for", but it does not allow any customization.
How can I change this menu? I don't want Safari to open when I search.
This appears to have been answered on stackoverflow already and on SuperUser even earlier.
The "search with google" entry is added by safari and therefore cannot be edited. So the solution is to disable that one, create your own service using automator, and then assign the appropriate shortcut key that will take precedence over the built-in disabled one. This is actually what I was going to suggest until I found that someone else had already gone through it.
I've copied/pasted answer from SO here.
Instructions:
Open Automator and choose Service as the type
Add a "Run Shell Script" action by dragging it to the right pane
-
Add script
open "http://www.google.com/search?q=$(ruby -rcgi -e 'print CGI.escape $<.read.chomp')"
Adjust the TLD as needed for your country specific Google page. ex: http://www.google.co.in/search?q=
A comment to the SO answer suggests - instead of "Run shell script" you can also use "Run javascript", use script
function run(input, parameters) { return "google.com/search?q=" + encodeURI(input) }
, and stack additional action "Internet > Open webpages" underneath. It could work faster. Also see SU answer Save the service as "Search Google"
Activate the service in System Preferences and optionally assign a keyboard shortcut. Once activated, "Search Google" will appear in the context menu