Double your productivity with the Hyper Key

I think keyboard shortcuts are incredibly powerful and can save us hours every week, by allowing us to work close to the speed of thought, and as a result help us enter or maintain the flow state. Even if you think that you don't use shortcuts, I'm sure you are familiar with Ctrl+Z, Ctrl+C and Ctrl+V.

In this article, I'll show an approach that enables you to think differently about shortcuts and opens new opportunities for productivity boosts. Some specifics here will be relevant only for Mac, but the general concepts are OS-agnostic, so you can still learn a bunch, even if you are a Windows/Linux user.

thumbnail with keys

Switching Apps

Let's start with one of the most common operations for any computer user – switching apps. Doing this with a mouse is slow, so every operating system comes with a keyboard shortcut, typically Alt+Tab (Windows) or Cmd+Tab (Mac). If you are using it, you are already saving time, but what if you could do it even faster?

The problem is, that it requires diverting your attention to the app list to find the one you need. This may sound negligible, but it does slow you down and, what's worse, stealing your precious focus. Having several virtual desktops can be helpful, but it doesn't solve an issue completely, since you can't have a desktop for each single app (and also because the animation is annoyingly slow).

The solution is to have shortcuts for the apps that you switch between the most. For me, it's the code editor, browser, terminal, notes and messenger. Here's what I would expect from these shortcuts:

  • be easy to remember – to memorize faster, like Cmd+C is for "Copy" or Cmd+T is for "New Tab"
  • won't require many fingers – who wants to press Cmd+Shift+Option at the same time?
  • won't conflict with other shortcuts – I would gladly use Cmd+T for Terminal and Cmd+C for code editor, but this is obviously not possible, because these shortcuts are already in use in most apps

Solution – Hyper Key

You may be surprised, but apart from basic modifiers, like Ctrl and Shift, there is another one that is present on pretty much every keyboard, it occupies a very convenient position on the keyboard yet is barely utilized. It is ...drumroll... the Caps Lock key!

What if we could reprogram it to act like another modifier and start creating new shortcuts with it? For that, we'll need Karabiner-Elements.

Implementing Hyper Key

Open Karabiner-Elements, go to "Complex Modifications" > "Add your own rule", and paste this:

{
    "manipulators": [
        {
            "description": "Change Caps Lock to Hyper Key.",
            "from": {
                "key_code": "caps_lock",
                "modifiers": {"optional": ["any"]}
            },
            "to": [
                {
                    "set_variable": {"name": "hyper", "value": 1}
                }
            ],
            "to_after_key_up": [
                {
                    "set_variable": {"name": "hyper", "value": 0}
                }
            ],
            "type": "basic"
        }
    ]
}

This will let Karabiner know that when Caps Lock is pressed, we are in "hyper mode", but it doesn't know what it means yet.

So let's create another rule, that only works in this "hyper mode":

{
    "description": "Hyper Key + C",
    "manipulators": [
        {
            "conditions": [
                {
                    "name": "hyper",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "description": "Open Calendar",
            "from": {
                "key_code": "c",
                "modifiers": {"optional": ["any"]}
            },
            "to": [{"shell_command": "open -a 'Calendar.app'"}],
            "type": "basic"
        }
    ]
}

Now press Caps Lock + C, and it should open the Calendar app. You can now proceed to create shortcuts for your most used apps, and start switching using your newly available hyper key.

Note: you don't have to use Caps Lock as hyper key, it can be anything, as long as you don't use it too often, like the little button between Shift and Z on European keyboards, but Caps Lock seems to be the perfect choice for most of us, because of its position and non-essential default function.

Handling Many Shortcuts

Obviously, there's only so many keys on the keyboard that you can combine with the hyper key. For example, if you start creating shortcuts for window management (maximize window, left half, right half, top half, bottom half, left third, bottom-right quarter etc.), you will very quickly run out of keys.

The solution is to use layered shortcuts. Basically, it means pressing another key, so instead of Hyper+M for maximizing a window, you would press Hyper+W+M. It's a bit unusual to have multiple non-modifier keys in a single combination, but the beauty of this approach is in the semantics: you can group all your window management-related shortcuts under Hyper+W, all your system-related shortucts under Hyper+S (Hyper+S+] for volume up, Hyper+S+[ for volume down, Hyper+S+M for mute) and so on.

Creating Layered Shortcuts

Implementing this by hand can be a bit cumbersome and error-prone, so I think it's a good moment to introduce this little project. Here's a little snippet showing how easy it is to tailor your own Hyper Key configuration:

t: app("iTerm"),
s: app("Slack"),
g: app("Google Chrome"),
// b = "B"rowse
b: {
  y: open("https://youtube.com"),
  m: open("https://maps.google.com"),
  e: open("https://mail.google.com"),
},
// w = "Window"
w: {
  equal_sign: open("-g raycast://extensions/raycast/window-management/make-larger"),
  hyphen: open("-g raycast://extensions/raycast/window-management/make-smaller"),
  l: open("-g raycast://extensions/raycast/window-management/almost-maximize"),
  m: open("-g raycast://extensions/raycast/window-management/maximize"),
},
// s = "System"
s: {
  open_bracket: {
    to: [{key_code: "volume_increment"}],
  },
  close_bracket: {
    to: [{key_code: "volume_decrement"}],
  },
}

The project has a decent README, so I won't explain how to use it.

Note: the example above uses raycast://extensions/window-management/<command> deeplinks for window management. It will only work if you have Raycast installed, which is one of the greatest productivity tools for Mac users. Alternatively, for window management, you can use Rectangle.

Extra Tips

For Using Caps

If you still need to use Caps Lock from time to time, you can create a shortcut for it, like Cmd+Caps Lock. The configuration would look like this:

{
    "description": "Cmd+Caps Lock to Caps Lock",
    "manipulators": [
        {
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "mandatory": ["left_command"],
                    "optional": ["any"]
                }
            },
            "to": [{"key_code": "caps_lock"}],
            "type": "basic"
        }
    ]
}

Switching Input Sources

If you are often using multiple input sources, you can use hyper key to switch between them, by just clicking on it.

To do that, you'll just need to add to_if_alone configuration to the Change Caps Lock to Hyper Key. rule:

{
    "manipulators": [
        {
            "description": "Change Caps Lock to Hyper Key.",
            "from": ...,
            "to": ...,
            "to_after_key_up": ...,
            "to_if_alone": [{"key_code": "f18"}],
            "type": "basic"
        }
    ]
}

I chose the F18 key, because it's not used by any app by default, so there won't be any conflicts. Now you need to go to "System Preferences" > "Keyboard" > "Keyboard Shortcuts..." > "Input Sources", and set the shortcut for switching input sources to F18:

Switching input sources screenshot

Main Takeaways

Even if you aren't a Mac user, I think there are still quite a few takeaways for you from this article:

  • even the most common actions can take more of your focus than they should
  • keyboard shortcuts are a great way of accelerating your workflow to the speed of thought
  • hyper key allows you to customize shortucts to work seamlessly across all apps
  • Caps Lock is a great key in terms of position, but it's rarely used, so it's a great candidate for hyper key usage
  • layered shortcuts allow you to exponentially increase the number of hyper key combinations, without losing the memorizability