Configure a Hyper Key on OSX

If you're anything like me, you like keyboard shortcuts. I like to set up custom shortcuts and macros to automate everything I can. The problem is that the most convenient keyboard combinations are already in use by the OS or by an app. That's where the Hyper Key (also sometimes called a Super Key) comes in.

Basically: Get rid of the useless caps-lock key and turn it into a new modifier key that won't be used.

Check out this AskUbuntu post for some history behind the "Super" and "Hyper" keys.

How it works

What we'll do is disable the normal caps-lock key functionality and re-map it to the F19 key (which most keyboards don't have anyway). Then we'll re-map F19 to be Shift+Ctrl+Option+Command. Since no sane app uses this hard-to-press key combo, it essentially means we've invented a new hyper key.

Setup

1. Install the software

Download and install the following software, and then restart.

  • Seil will let you re-map the caps lock key.
  • Karabiner will let you map the F19 key.

2. Disable the system caps lock key

  • Open System Preferences
  • Navigate to the Keyboard pane
  • Click on the Modifier Keys button in the lower-right
  • Change the Caps Lock Key to No Action

Disable caps lock key in System Preferences

3. Re-map the caps lock key

  • Launch Seil
  • Expand the Change the caps lock key tree
  • Check the checkbox
  • Double-click the empty cell in the keycode column and enter 80

Re-map the caps lock key using Seil

80 is the keycode for the F19 key. You can use the bottom pane to find the keycode for some other key if you don't want to use F19.

4. Map F19 to the hyper key combo

  • Open Karabiner
  • Go to the Misc & Uninstall tab
  • Click the Open private.xml button.

Map F19 key using Karabiner - 1

This should open Finder and reveal a private.xml file. Open this file in your favourite text editor and enter the following code:

<?xml version="1.0"?>  
<root>  
    <item>
    <name>Remap F19 to Hyper</name>
    <appendix>This maps F19 to Control + Shift + Option + Command.</appendix>
    <identifier>nadeau.f19_to_hyper</identifier>
    <autogen>
        --KeyToKey--
        KeyCode::F19,
        KeyCode::COMMAND_L,
        ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
    </autogen>
</item>  
</root>  
  • Save the file
  • Back in Karabiner, go back to the first tab, Change Key
  • Click the Reload XML button
  • A new option at the top of the list should show up. This is the option we just created by editing the XML file. Check the checkbox to enable it.

Map F19 key using Karabiner - 2

Test it out

At this point, whenever you hold your caps lock key, it is the same as if you were pressing Shift+Ctrl+Option+Command.

You can test it out by using Karabiner:

  • Open Karabiner
  • Go to the Misc & Uninstall tab
  • Click the Launch EventViewer button
  • Now press your Caps Lock key. You should see the event table populate with a few rows, the last of which should show Shift Ctrl Opt Cmd under the flags column. This means it's working.

Karabiner EventViewer

Configuring new keyboard shortcuts

Now that it's set up, you can begin using it for realsies. Here's how:

  • Open System Preferences
  • Navigate to the Keyboard pane
  • Click through to the Shortcuts tab
  • Under App Shortcuts, click the + button to add a shortcut.

For example, I use Path Finder and often I want to copy the full path to a selected file. Path Finder has a menu option for this.

Here's how I can create a new keyboard combo for this menu item:

The keyboard shortcut was entered by holding Caps Lock+C.

Keyboard Maestro

If you want to get even more out of your new hyper key, check out Keyboard Maestro.

KM lets you create macros and automated workflows. Triggering macros with keyboard shortcuts is super super useful. For example, I have a macro that pastes my clipboard without formatting -- I use it dozens of times a day.

Keyboard Maestro - Paste without formatting