Quickly open a new Chrome tab/window from anywhere

Jun 30, '11 07:30:00AM

Contributed by: wmertens

If you're a Google Chrome user, you may like its Omnibar because it allows you to instantly search the web and leverage your URL history at the same time. This hint explains how to instantly get to an Omnibar from within any application.

You need two things for this hint: An AppleScript and a hotkey manager. For the hotkey manager I use Quicksilver but anything that allows you to run AppleScripts or applications on a keystroke is fine.

For the script, open AppleScript Editor and save the following code as a script (or an application if you're going to run it as an application), for example calling it Open Omnibar.

tell application "Google Chrome"
  if (count of windows) is 0 or front window is not visible then
    make new window
  else
    make new tab at end of tabs of front window
  end if
  activate
end tell
What this code does is first it checks if any Chrome windows are visible, if not it opens a new window. If a window is visible you get a new tab. Chrome automatically places the cursor in the Omnibar.

So if you assign this script to a hotkey, you can simply hit the hotkey and when you see the Omnibar, start typing.

[crarko adds: I haven't tested this one. If you're running Snow Leopard you could probably set this up as an Automator Service that runs the script.]

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2011063004574025