I'd like for results from the search toolbar to open in a new tab by default, like I've configured in Firefox. How can I get this same default behavior in Safari? I already know that Command-Enter will do this for me, but I want to change the default behavior so that I don't have to hold down Command every time I do a search.
-
Not an answer, but I wonder how you get the cursor into the search field to start with. If you use your mouse or touchpad, then maybe the following makes your workflow a bit easier: Command-N for a new window, followed by Tab to get into the search field, and after typing your search text: Return to show the search results in that (new) window.– ArjanOct 28, 2010 at 19:40
-
@Arjan: Can be slow on some machines, because it might load the Top Sites for new windows. Cmd-L for Location bar, Tab, Search, Cmd-Enter is faster (at least on my machine and in my opinion).– Daniel Beck ♦Oct 28, 2010 at 19:45
-
@Arjan Glims can be configured to focus the search field for new windows and tabs. Saves a keystroke.– Daniel Beck ♦Oct 28, 2010 at 20:16
-
I don't think it's possible. I just checked Saft (well-known commercial Safari modification), Glims and the Safari Extensions library, nothing turned up. It seems you need to continue using Firefox for full customizability.– Daniel Beck ♦Oct 28, 2010 at 20:26
-
Wow, that's horrible. -1 to Safari.– JeffOct 28, 2010 at 22:52
4 Answers
If you're in to some work, then Glims with a custom search provider, and some AppleScript to create your own protocol handler (URL scheme) can do the trick. But I think pressing Command-Return is much easier. ;-)
Here's what you'd need:
Open Applications, AppleScript Editor, and paste the following:
-- See http://superuser.com/questions/204435/ on open location fullUrl -- fullUrl includes the URL scheme, like "newwindow:" or "newwindow://" set a to the offset of ":" in fullUrl set b to the offset of "//" in fullUrl if b = a + 1 then set a to a + 2 set theUrl to text from (a + 1) to -1 of fullUrl -- Delegate the new URL to whatever is the default handler: tell application "System Events" open location theUrl end tell end open location -- Just in case this is invoked directly from Finder: set choice to button returned of (display dialog "Please use a URL like newwindow://http://google.com to use this." buttons {"More info...", "Cancel"}) if choice = "More info..." then tell application "System Events" open location "http://superuser.com/questions/204435/" end tell end if
Select menu File, Save As, and be sure to select File Format: "Application". This will create something that looks like a single application, but actually holds a folder structure.
In Finder, find the place where you saved the application, right-click it and select "Show package contents".
Find file
Contents/FileInfo.plist
and open it with a text editor.At the end, just above the last two lines
</dict></plist>
, add:<key>CFBundleIdentifier</key> <string>com.superuser.204435.NewWindow</string> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>NewWindow</string> <key>CFBundleURLSchemes</key> <array> <string>newwindow</string> </array> </dict> </array>
Move the whole application package into, for example, Application/Utilities (to ensure Launch Services registers it).
Test in any browser, using
newwindow://http://www.google.com/search?q=abc
. If it doesn't work, then double-click the application or even rename the package, just to trigger the discovery by Launch Services again.Install the Glims plugin for Safari.
In Safari's preferences, tab sheet Glims, Search Engine List, add a new entry. Note that Glims requires the slashes after
newwindow:
. Without that, Glims would prefixhttp://
to whatever text you entered:newwindow://http://google.com/search?q=#query#
I don't know how to change the icon that Glims shows... Also, when using this, there's no key you can hold down to not open the results in a new window.
-
...and to open in a new Tab: set Safari to use tabs when a new window is opened. Did I mention that Command-Return is soooo much easier? ;-)– ArjanOct 31, 2010 at 22:10
-
-
-
1
Here's what I found out so far:
- It is not possible in vanilla Safari
- It is not added in Saft (well-known commercial Safari modification)
- It is not added in Glims.
- There is no Safari extension for that and the Safari API does not support this for an extension.
Therefore, I don't think it's possible. It seems you need to continue using Firefox for full customizability.
-
-
-
I mean this does not answer the question. But now this question no longer has zero answers, and hence might not trigger others to read it?– ArjanOct 28, 2010 at 20:17
Jeff wrote:
...I wonder how you get the cursor into the search field to start with...
You can do that with Command-k just as you would with Firefox. Just go into Apple -> Preferences -> Keyboard and add a new keyboard shortcut for Safari.
-
Jeff didn't write that, Arjan did. Furthermore, Command-Option-F is the shortcut to directly focus the search bar. Apr 3, 2011 at 18:10
Be default, here is how I do it:
- With Safari open, press CMD + OPTION + F (puts cursor in search field)
- enter my search term
- press CMD + ENTER (opens results in a new tab)
- Done, search results open in a new tab in 4 seconds or less
That said, I have updated CMD + OPTION + F to be CMD + K to match Firefox (and I think Chrome?)… but I would prefer that there was a checkbox in Safari Preferences on the "Tabs" tab to make search results open in a new tab.
-
-
1