Keystroke Sequence Shortcuts in Mac OS X

It is a headache to find an available keyboard shortcuts in Mac OS X. I used Option + Letter and Shift + Option + Letter before, since they are preserved for inputting special characters. It has some problems:

  • Emacs and terminal require a modifier for Meta. I choosed Command. It means if I want to use application shortcut with Command in these applications, such as Command+Q to quit the application, I have to use the right one.
  • I always forget the shortcuts. Although I have listed them in a sheet, it is a pain to keep it synchronized with the shortcuts defined every where.

I switched to a new solution using keystroke sequence shortcuts recently. All my global shortcuts start with Command+M (⌘M). A menu is displayed when I typed prefix. If I forget the shortcut, I just need to glance through the menu.

Shortcuts Menu
The shortcuts menu shows all available commands and the corresponding keyboard binding.

Disable System Default Shortcut

⌘M is a system default shortcut to minimize window. I never use it, and it is annoyed when typed by acident. So I disable it and use it as my personal keytroke sequence shortcuts prefix.

Run the following code1 in terminal to disable it.

defaults write -g NSUserKeyEquivalents -dict-add 'Minimize' '\0'

The changes are applied only in new opened apps. Please reopen all applications, or just restart the system.

Keyboard Maestro

The shortcuts and the menu in the snapshot are managed by Keyboard Maestro. There are two ways to implement keystroke sequence in Keyboard Maestro.

The first solution is setting the same keyboard shortcut for multiple macros. Keyboard Maestro auto detects conflicts and display a menu like the one above. It strips the common prefix, and use the first distinct letter in macro name as the shortcut. Thus, it does not support modifier (like Shift, Command) in subsequent shortcut. And it requires some trick to name your commands, such as “l) Read Later” and “v) Clipboard History”.

Since I want to use modifier, I use another solution: a group with the option “Shows a palette for one action when the hot key xxx is pressed”.

Keyboard Maestro shortcut prefix group
Shows a pallete for one action when the hot key xxx is pressed.

It is tricky to display the shortcuts and align them to the right in the menu like in the snapshot. The shortcuts should be added in command name manually and are aligned by inserting tabs and spaces.

Shortcuts Forwarding

Some application provides global shortcuts, but they cannot be used in Keyboard Maestro. The workaround is using a rarely used and hard to type in the application preference, and forward using a simple shortcut through Keyboard Maestro.

For example, I defined the Alfred 2 clipboard manager shortcut to Ctrl+Option+Shift+Command+F4. I use Command+M, Command+V (Hold Command, type M, then V, and release Command) to show it, because I have a macro in the Command+M group which uses the action “Type a Keystroke”.

Shortcut Forward
Send a global shortcut in an application from Keyboard Maestro by sending a keystroke.

  1. ↩︎

comments powered by Disqus