MacOS – What do I need to know for setting key combination shortcuts

defaultskeyboardmacospreferencesservices

I am running OS X Mavericks 10.9 and I want to create a new key combination shortcut for, lets say, 'Look Up in Dictionary'. Personally I think CommandShiftD or CommandOptionD would be nice.

When I choose for the latter nothing happens in the preferences 'Keyboard' window and my Dock hides. I expected this behavior but OSX gives me no notice of it, I might just have activated something else without knowing it.

When I choose for the first, it looks like it just works as aspected, my key combination gets set. But when I use the shortcut in Safari on a selected word, the page is suddenly added to my reading list (as CommandShiftD is the default keystroke to do so) and the dictionary does not open as expected.

This behavior leeds me to two problems about what do I need to know for setting key combination shortcuts.

  • Is there a way to see what key combination is already taken, and for what purpose?

As M-K describes the apple manual states yellow warning triangle appears when a short-cut is already taken, but as the screenshots show this is not the case in OS X 10.9 Mavericks.

  • Is there a key combination convention or rule for the different modifier keys? What key would be appropriate for what task? (e.g. when would I choose for Command or Shift or Option or Ctrl) or one of the function keys)

keyboard shortcut settings

Below is my example of two different scripts (Run in Terminal and Launch Terminal) with the same keystroke (CommandF19) to activate them and no error

Launch in terminal and run in terminal

Best Answer

1. Is there a way to see what key combination is already taken, and for what purpose?

You can see if there is a conflict with your chosen shortcut. From "If a keyboard shortcut doesn’t work":

  1. Choose Apple menu > System Preferences, and then click Keyboard.
  2. Click Keyboard Shortcuts. A yellow warning triangle appears next to conflicting keyboard shortcuts.

2. Is there a key combination convention or rule for the different modifier keys? What key would be appropriate for what task? (e.g. when would I choose Command or Shift or Option or Ctrl or one of the function keys)

For dictionary lookups, Apple has already defined Ctrl+Cmd+D as "Display the definition of the selected word in the Dictionary app."

The OS X Human Interface Guidelines on Keyboard Shortcuts states the following about when to use these modifier keys and for what purposes. The recommended priority is to use Cmd frequently, use Option sparingly, avoid using Ctrl and use Shift for complementary functions of a common command (of course, you may observe that in certain instances Apple does not follow these guidelines).

Quote from the Keyboard Shortcuts page:

As much as possible, use the Command key as the main modifier key in a keyboard shortcut. For example, Command-P uses Command to modify the P key. For a command that complements another more common command, you can add Shift to the shortcut. For example, the shortcut for the complementary Page Setup command adds Shift to the shortcut for Print to give Shift-Command-P.

Use the Option key sparingly. If there’s a third, less common command that’s related to a pair of commands that use Command and Shift-Command, you can use Option-Command for the third command’s keyboard equivalent. Use combinations like these very rarely. You can also use Option for a keyboard shortcut that’s a convenience or power-user feature. For example, the Finder uses Option-Command-W for Close All Windows and Option-Command-M for Minimize All Windows.

As much as possible, avoid using the Control key. Because the Control key is already used by some of the universal access features—as well as in Cocoa text fields where Emacs-style key bindings are often used—it should be used as a modifier key only when necessary.

List multiple modifier keys in the correct order. If you use more than one modifier key in a shortcut, always list them in this order: Control, Option, Shift, Command.