1

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.

7
  • 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.
    – Arjan
    Oct 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.
    – Jeff
    Oct 28, 2010 at 22:52

4 Answers 4

3

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:

  1. 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
    
  2. 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.

  3. In Finder, find the place where you saved the application, right-click it and select "Show package contents".

  4. Find file Contents/FileInfo.plist and open it with a text editor.

  5. 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>
    
  6. Move the whole application package into, for example, Application/Utilities (to ensure Launch Services registers it).

  7. 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.

  8. Install the Glims plugin for Safari.

  9. 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 prefix http:// 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.

4
  • ...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? ;-)
    – Arjan
    Oct 31, 2010 at 22:10
  • Yikes! I think I'll stick with Command-Return for now.
    – Jeff
    Nov 2, 2010 at 3:29
  • And generally I guess I'll use Chrome and Firefox instead of Safari.
    – Jeff
    Nov 2, 2010 at 3:30
  • 1
    Wow. This is... insane. Wow. Good job!
    – Daniel Beck
    Nov 2, 2010 at 6:55
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.

3
  • Hmmm, now the homepage shows this question has an answer...
    – Arjan
    Oct 28, 2010 at 20:08
  • @Arjan what do you mean?
    – Daniel Beck
    Oct 28, 2010 at 20:11
  • 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?
    – Arjan
    Oct 28, 2010 at 20:17
0

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.

1
  • Jeff didn't write that, Arjan did. Furthermore, Command-Option-F is the shortcut to directly focus the search bar.
    – NReilingh
    Apr 3, 2011 at 18:10
0

Be default, here is how I do it:

  1. With Safari open, press CMD + OPTION + F (puts cursor in search field)
  2. enter my search term
  3. press CMD + ENTER (opens results in a new tab)
  4. 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.

2
  • Note: To customize the Safari search shortcut you have to:
    – jono
    Dec 11, 2011 at 2:27
  • 1
    … you have to do what?
    – slhck
    Dec 11, 2011 at 9:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .