I've started using Slate for window management in OS X. It's lovely being able to drive specific operations with the keyboard, but what's not lovely is trying to find a spare keyboard shortcut that doesn't need lots of fingers and doesn't clash with another app.
Taking inspiration from this article and the article it took inspiration from, I've taken to mapping Caps Lock to Shift+Ctrl+Option+Command, which is such a crazy set of modifiers that no app would ever have a default keyboard shortcut based on it. That means I get a single key which acts like all four normal modifier keys combined, so I get a whole blank keyboard of shortcuts all to myself!
The specifics of how I did this:
- Open System Preferences, then Keyboard, then Modifier Keys
- For each keyboard listed, set Caps Lock to No Action
- Install KeyRemap4MacBook and PCKeyboardHack, then restart your Mac
- Open System Preferences, then PCKeyboardHack
- Tick Change Caps Lock and set the keycode it sends, to 80 (which is really F19. If you have a keyboard which has a real F19 key, you need to change this to a different key you don't have)
- Go back to the main System Preferences page (click Show All, or re-open System Preferences) and open KeyRemap4MacBook
- Choose the Misc & Uninstall tab and click Open private.xml. This will give you a Finder window with a private.xml visible
- Right click private.xml and choose Open With then TextEdit.app
- Paste the following between the <root> and </root> tags:
<name>Remap F19 to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps F19 to Control + Shift + Option + Command.</appendix>
ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
- Save and Quit the private.xml window, close the Finder window
- Back in the KeyRemap4MacBook preferences, switch to the Change Key tab and click ReloadXML
- You should now see Remap F19 to Hyper at the top of the list. Tick it.
- At this point you should be done, but we can easily test to make sure...
- Switch to the Misc & Uninstall tab in the KeyRemap4MacBook preferences and Launch EventViewer
- Press your Caps Lock key and you should see a series of events appear, each of which adds/removes one of the Shift/Ctrl/Option/Command keys. The middle row should have Shift Ctrl Opt Cmd in the flags column. If you see that, you are done!
- Configure lots of shiny new Hyper shortcuts in Slate or whatever other app you like!