My Quest to Align Hotkeys on macOS and GNOME

I’m the type of person that will invest way too much time trying to juice my productivity. While I try to keep things as close to stock as possible, I do rely heavily on a small number of hotkeys. The problem is, the hotkeys that I’ve grown to love the most are somewhat GNOME specific, and I’ve always struggled to reach parity on macOS.

I’ve talked about how I like to switch apps previously. This method of using SUPER+1-9 is baked into GNOME. I was able to simulate something similar on macOS by way of mapping RIGHT COMMAND to HYPER via the Hyperkey app. It worked well enough, with Hammerspoon handling the mapping of the additional hotkeys.

For a while now, I’ve been thinking of remapping CAPS LOCK to HYPER instead of an additional CONTROL key. Back in the day I had CAPS LOCK mapped to ESC and then eventually to CONTROL. The position of the CAPS LOCK key makes for a great CONTROL as the normal LEFT CONTROL position doesn’t feel natural to me when slapping out commands in Tmux.

So I did that, and after a week or so of fumbling around, things were starting to feel a bit more natural. The only problem was, with only a small handful of things that utilized HYPER it wasn’t feeling as useful as I had expected it to be. I think if I had a whole slew of things that relied on HYPER it would have felt better, but I ultimately ended up back to an extra CONTROL key.

What I like about GNOME

GNOME does a great job with some out of the box hotkeys. My favorite, as mentioned, is being able to jump between the apps on your dock with SUPER+1-9. The numbers correspond to the position of the app on your dock, and I still believe this is absolutely the best way to jump between your most used apps.

The other thing I love is how you can bring up the overview / launcher just by tapping the SUPER key. You have the option of choosing LEFT SUPER or RIGHT SUPER, which I opt for the latter. The reason I prefer utilizing the RIGHT SUPER is because I find it to be a fairly under utilized key. Giving the key some additional purpose felt natural and doesn’t conflict with any other hotkeys that rely on using SUPER.

Since Linux relies mostly on the CONTROL key and macOS on COMMAND I do still have a bit of adjustment when I switch between rigs. Regardless of which key I’m using, I effectively dedicate my left hand to tasks like copy and paste. My right hand is dedicated to bringing up the launcher, quick jumps between apps, and window snapping.

While GNOME does have window snapping hotkeys, I do remap those to SUPER+WASD to do window maximizing (SUPER+W), snapping 50% left or right (SUPER+A left, SUPER+D right) and “restoring” a window to a smaller size (SUPER+S).

Shaking things up

As mentioned, I recently moved my HYPER key over, and while it didn’t quite work out, it really got me thinking about how to pull off a more unified hotkey experience across GNOME and macOS.

In all of this soul searching, I also swapped Spotlight for Raycast. The big appeal there was that Raycast can do window snapping (with hotkeys), and made it dead simple to map hotkeys to applications.

And to shake things up even further, when I moved HYPER to CAPS LOCK with Hyperkey, I noticed some “key bleed” when hitting HYPER inside of Alacritty. Effectively, HYPER was functioning as both HYPER and sending the CONTROL signal. Because of this I started to play around more with Karabiner-Elements.

Ultimately, updating Alacritty seemed to have gotten rid of the odd behavior. At that point in the process, I was already committed to Karabiner-Elements and using Raycast’s hotkeys. This allowed me to completely remove Hyperkey and Hammerspoon from my system.

The best of both worlds

To recap, here’s what I was attempting to accomplish on macOS, which is dead simple to pull off with minimal configuration in GNOME:

  • RIGHT COMMAND – Open launcher (Spotlight, Raycast, Alfred, etc)
  • RIGHT COMMAND+1-9 – Launch / switch between frequently used apps
  • RIGHT COMMAND+WASD – Window movement / snapping
  • CAPS LOCK – additional CONTROL key

I was able to pull this off by doing the following inside of Karabiner-Elements

  • Add a “Simple Modification” to map caps_lock to left_control
  • Add a “Complex Modification” to:
    • Turn right_command into F20 when used alone
    • Turn right_command intoleft_shift+left_command+left_control+left_option when not used alone

The complex modification looks like this:

{
    "manipulators": [
        {
            "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": "f20" }],
            "type": "basic"
        }
    ]
}
Karabiner-Elements Complex Modification

To make use of this doctoring up of the RIGHT COMMAND key, I simply configured some hotkeys inside of Raycast:

  • F20 to open Raycast
  • HYPER+... for the rest:

Conclusion

Was it even worth it? For me, absolutely. I switch between GNOME and macOS at least a few times per day, so having a unified experience helps me with the context switching.

I also find this setup to be extremely productive. It’s why I’m okay investing the time to try to figure out how to pull it off. I’m thoroughly stoked to have finally been able to reach this point after quite a few previous attempts.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.