Starting application with custom keyboard shortcut

Mac OS 10.6 has a "Keyboard Shortcuts" preference pane in System Preferences. It lets you add new entries, but they don't seem to work. Is this the correct way to add hotkeys? For instance I would like Command+Esc to open Terminal.app.


Solution 1:

You have to deal with two issues here

  • You can only assign keyboard shortcuts to applications' menu items and services. Terminal.app is neither.
  • You cannot usually create a keyboard shortcut using Esc for Services in System Preferences » Keyboard » Keyboard Shortcuts.

Make sure a real application launcher such as Quicksilver, Alfred or LaunchBar wouldn't be the better solution.

For a Terminal, have a look at Visor. It allows you to create a HUD console. If you played Quake, you know how it works.


That being said, you can make this work.

First, create a Service by starting /Applications/Automator.app and select the Service template. Select the Utilities library and double-click Launch Application. Select Other... from the popu-menu and then select /Applications/Utilities/Terminal.app.

Above the Launch Application command, select no input and any application.

Press Command-S to save, and name it Launch Terminal.


Now, Open System Preferences » Keyboard » Keyboard Shortcuts, select Application Shortcuts (not Services!). Click the + button, and select All Applications. As name, type Launch Terminal. Then, select the keyboard shortcut input field and press Command-Esc. Click Add.

Done. Now there's a new menu item in Application Menu » Services named Launch Terminal, with the keyboard shortcut Command-Esc, and selecting it starts Terminal.

enter image description here

Solution 2:

There's a bug where the shortcuts for Automator services don't always work until the services menu has been shown once from the menu bar. And they won't be available in applications that don't have a Services menu. There's also a noticeable delay before they are run.

Using a third party application like Alfred would be a better idea.

You could also assign shortcuts to shell commands like open -a iTunes.

This would block the script until the application has finished opening, so it would seem to take longer if it was run with FastScripts:

tell application "iTunes"
    reopen
    activate
end tell