The Hyperkey: Supercharge Your Keyboard Workflow


As someone who spends most of their time behind a keyboard, optimizing its use is essential. While I already have numerous keybindings for apps like Neovim and Tmux, one thing that’s been missing is a set of global hotkeys to quickly access my favorite apps and more.

The Key to Unlocking Efficiency

When it comes to keyboard shortcuts, keys and key combinations are limited. That’s where the concept of a “Hyperkey” comes in handy. The Hyperkey is a single key mapped to a combination. On a Mac this is typically Shift + Ctrl + Opt + Cmd, opening up a whole new territory of possibilities.

Finding the Perfect Key

To set up a Hyperkey, you need to find an unused key that will serve as the combo maker. The typical choice is the Caps Lock key. However, in my case, I was already using Caps Lock as a replacement for Escape (single-click) and Ctrl (when holding down) for Vim.

After some trial and error, I landed on the Right Command key. It’s a key I never use, and it’s comfortably reachable with my right thumb.

Implementing the Hyperkey

To implement the Hyperkey and make it function as desired, I used Karabiner Elements, a powerful keyboard customizer for macOS.

Here’s a snippet from my Karabiner config (~/.config/karabiner/karabiner.json), where I define rules to manipulate keys and their actions:

"rules": [
  {
    "manipulators": [
      {
        "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
        "from": {
          "key_code": "caps_lock",
          "modifiers": {
            "optional": [
              "any"
            ]
          }
        },
        "to": [
          {
            "key_code": "left_control"
          }
        ],
        "to_if_alone": [
          {
            "key_code": "escape"
          }
        ],
        "type": "basic"
      },
      {
        "description": "Change right_command to command+control+option+shift.",
        "from": {
          "key_code": "right_command",
          "modifiers": {
            "optional": [
              "any"
            ]
          }
        },
        "to": [
          {
            "key_code": "left_shift",
            "modifiers": [
              "left_command",
              "left_control",
              "left_option"
            ]
          }
        ],
        "to_if_alone": [
          {
            "key_code": "right_command"
          }
        ],
        "type": "basic"
      }
    ]
  }
]

Putting the Hyperkey to Work

Launch Raycast, open the Extensions under Settings, and start assigning hotkeys! Here’s one of mine for Obsidian: Hyper + o.

Raycast even has a setting to display the Hyperkey instead of the individual key combination. To enable this, go to Settings > Advanced, and check the Hyper Key checkbox.

Helpful Resources

Conclusion

Any recurring workflow that you perform should be augmented or automated. Therefore, I encourage everyone to leverage keyboard shortcuts to optimize their daily workflow. Check out some examples, try things out, and adjust them to your liking.

Automating repetitive tasks and optimizing your workflow is a surefire way to boost productivity and focus on what really matters.



Source link