How to manage global keyboard shortcuts?

I’m struggling to understand how global (keyboard) shortcuts are managed on macOS, which means keep ending up in situations where a shortcut doesn’t work and I’m not sure how to fix it.

For a long time, my troubleshooting workflow has been:

  1. If the app whose local shortcut doesn’t work has extensions (e.g. browsers, obsidian, etc), check whether multiple extensions have registered the shortcut.
  2. Check System Preferences → Keyboard → Shortcuts whether the shortcut is registered as a global shortcut

Then I discovered that the Alfred registers global shortcuts which don’t show up in System Preferences (and apparently there is no way to simply list them all?). So, I suppose that if Alfred can do it, any app can do it, right?

Hence my question: how do I manage all these global shortcuts?

My preferred answer to this question would be: use this app which gathers all shortcuts on your system and displays them for you (while also alerting you to potential conflicts). But if that app existed, I would probably have found it. I suppose that such an app is practically impossible to build because there simply is no single place where those shortcuts are registered.

So, what is to be done?

To make this big question somewhat more tangible, I’ll give you three examples:

Example 1

I have ⇧⌘L registered for an Alfred Workflow and it has been working fine ever since. But now I saw this:

and wonder: so Alfred is overriding a centrally registered global shortcut? Wouldn’t have expected that. (<rant> Apparently Apple is compensating its excessive control policies in some areas with excessive laissez-faire elsewhere</rant>)

So, how do I know what takes precedence over what?

Example 2

The latest update of the Arc Browser tells me that I can access extensions via ⌘E. But when I press ⌘E (while Arc is in focus), this opens the “New Task” modal in the Clickup desktop app.

I figured that one out by going to the Clickup settings and disabling the Shortcut there.

Example 3

⌥⇧← and ⌥⇧→ are supposed to select the word left/right of the cursor. But on my system, it changes the which window is in focus. I vaguely remember setting this up when I was trying out yabai or Amethyst, but I don’t remember how or where. Maybe it was in Better Touch Tool? - Indeed, it was.


“So,” you may be wondering, “what do you want? You solved them all!” - I’m just wondering whether there is a better way of managing global shortcuts…

And, as a little bonus question: can anyone suggest a resource that explains what to consider when setting up custom shortcuts (global and local) so that they both make sense and are less likely to conflict with existing ones? What I mean is: what are the basic logics behind the different modifier keys and their combinations with each other.

For example, I avoid pure ⌥- shortcuts, because they are often used to access special characters on the keyboard. I also have this idea of using ⌘-shortcuts for within app commands, and ⌃-shortcuts for commands at a “higher” level, but that logic is already broken, since I use ⌘-space to trigger Alfred search. Anyway, if you have any kind of “system” for how you design your shortcuts, you get the idea.

1 Like

Yes, it’s a mess.

CheatSheet might be helpful. It shows the active shortcuts.

And Shortcut Detective shows which app will get a shortcut.
https://www.irradiatedsoftware.com/labs/#shortcutdetective

2 Likes

Similar to CheatSheet is KeyCue, from the same folks that make Typinator.

I don’t have a process other than keeping a document listing any I add, in addition to adding them to KeyCue.

So you have to add them to KeyCue manually? I’ve used KeyCue for a couple of months but my impression was that it often fails to detect all shortcuts so it became yet another place to look and not find. In particular, I seem to remember that it only knew the global shortcuts that are also visible in system prefs. But maybe Imshould give it another try? After all, it is a benefit of having those all on one page.

I like the investigative approach of Shortcut Detective, but even that one says it can’t detect all shortcuts. Not even when you press them…

No, but if KeyCue doesn’t recognize the shortcut you can. From the user guide:

The KeyCue Settings window contains a “Custom” section where you can enter additional shortcuts that cannot be detected automatically by KeyCue. For example, some applications accept hard-wired keyboard combinations for certain operations that are not listed in the menus and therefore cannot be found by KeyCue. The Custom section makes it easy to de- scribe additional shortcuts specifically for all your applications.

There is also a learning mode, for applications which do not follow Apple’s guidelines, again from the user guide:

To work around these special cases, KeyCue features a “learning
mode”, where KeyCue memorizes the menu shortcuts of these ap-
plications when you manually open a menu by clicking it in the menu bar.

There is also a setting that adds a section for Macro hotkeys, although the macro utilities supported is limited (Keyboard Maestro is supported).

While some might balk at the one time US$25 price tag, I find it a useful utility.

1 Like

i dislike apps that set up their own global macros, and disable or delete those shortcuts as soon as possible

DEVONthink famously did this with Cmd-/, much to the annoyance of many for not letting us know. Of course it was all our fault for not wanting them to do that.

I’m not sure, but I think apps that do this request Input Monitoring in Security & Privacy, so disallowing might be a strategy.

1 Like

@toffy one way to reduce your shortcuts clashing with others is to use Hyper (shift+cmd+opt+ctrl) as your modifiers, then remap a keyboard key to be Hyper (so you don’t have to do the Vulcan Nerve Pinch pressing the four keys).
I use caps lock, which is Hyper when held down, and F18 when tapped (to launch Raycast). You can do this with Karabiner-Elements from pqrs.org .
You could also define a key to be Meh (Shift+opt+ctrl), but the chances of a clash are slightly higher, as few software authors would ask you to use four modifiers, but three isn’t out of the question.

1 Like

And if Karabiner seems to complex there is the now freeware Hyperkey, a one trick pony.

I’ve not used it as I use Karibiner. I also believe that Better Touch Tool also supports setting up a hyper key, but I’ve not used BTT for that.

Ha, thanks for reminding me of that. I actually did set that up some time ago and forgot all about it. But it still works (just checked using ShortcutDetective!)

I think the reason I didn’t really set up any hyper shortcuts was that I wanted to learn how to do things properly on Mac rather than trying to make my Mac work like windows. (Hyper doesn’t exist on Windows, but still: using Hyper felt like one of those workarounds that you’d use when macOS doesn’t makes sense instead of learning how it works. I somehow thought: shortcuts on macOS are well organized and logical, I just haven’t figured it out yet.)

LOL, just this morning, I wrote on my todo list: “check if I’m using karabiner for anything, if not uninstall”. So, I checked now and found that I’m indeed not using it for anything. Not even for Hyper.

So there was another puzzle and I thought: now I need a Detective app that not only tells me which app will receive a shortcut but also which one is sending it… :rofl:

But I used my brain instead and figured out that it was Better Touch Tool that took over from Karabiner. (BTT does so much more than improving the Track Pad experience, it’s insane how much that app can do!). Do you see any downside in using BTT as opposed to Karabiner?

So, thanks for the Hyper trick. I do think that is a good strategy, now that I see the reality of macOS shortcuts.

Eww! No, not Windows!
Jimmy-fallon-ew GIFs - Get the best GIF on GIPHY

Hyper goes waaay back (1978) to the legendary Space Cadet keyboard made by Symbolics. The keyboard protocol in use now only supports four modifiers, so we have to emulate a Hyper key (really only Hyper in spirit).

One would think. But it’s the same across platforms. Really the only shortcuts that can make sense (beyond things like Ctrl-arrow), are in applications that use leader keys, such as Emacs. (Below is from the Doom Emacs configuration.)


You can kind of emulate this using Keyboard Maestro’s ‘conflict palettes’, but it never really gelled with me.

I’ve never used it more than just a few minutes. I really only need key remapping, so it seemed like overkill / duplication of what KE was doing for me.

You’re welcome!

1 Like

Because of this exact problem I started writing an app called FuzzyKey that would provide a fuzzy search bar for global (and local) hotkeys for your most important apps.

The app was never released because the problem is much harder than I expected.

There are multiple ways a macOS app can react to hotkeys:

  • Register them using old but still accepted Carbon APIs (there’s no official API to get a list of the registered hotkeys)
  • Add key equivalents to menu items (these are local only, most visible and what most apps like Cheatsheet extract)
  • Use an EventTap to listen to all incoming key events and react to them in code (this makes it impossible to know an app’s hotkeys without reverse engineering its code)

Thankfully the EventTap method is rarely used because it involves getting Accessibility Permissions (or at the very least, Input Monitoring). But sometimes it’s the only way, like in the case of Cmd-Space for Alfred, where the old Carbon APIs can’t accept Space as a hotkey)

What I had started doing in FuzzyKey is write parsers for the configuration files where those hotkeys might be declared. For example you might use skhd to control yabai using the keyboard, and those hotkeys can be extracted from ~/.skhdrc.

iTerm might store its keybindings in ~/Library/Preferences/com.googlecode.iterm2.plist, Alfred will use some SQLite DB somewhere in Application Support and so on…

As you can guess, this approach does not scale well, it doesn’t catch all hotkeys, and apps can change their settings format all the time so the app would be prone to breaking.

It’s unfortunate but there’s no easy solution for this, I’m still trying to find one myself.

6 Likes

You can also do this in Hammerspoon. I use Hyper-zero to enter a kind of mode where Hammerspoon is listening for single letter commands. So for example, hyper-0 e, hyper-0 p and hyper-0 $ all launch a dialog that lets me type in some text, but then Hammerspoon uses that text in different ways to modify a URL to achieve different results. By now it’s muscle memory.

2 Likes

I have to say I gave up on shortcuts, I uninstalled Hyperkey. I use Keyboard Maestro palettes now, I suggest folk try it. You still need a shortcut for the palette of course, there are two ways to call them up, as a kind of conflict palette or regular. You can then shoot off shortcuts from them, for example I open a tranche of shortcuts with command space. Then I can open a set of tabs in Safari, I have four different sets on the palette with a letter, ‘a’ in this case, which then creates a conflct palette of shortcuts starting with ‘a’, I then pick the one I want, say ‘aw’ by typing the second letter.
Get an expert on Keyboard Maestro to explain it, I do it all the time, but I forget the terms for the different things there. It sound complicated but is, actually very fast after one or two times.

1 Like

I use KM conflict palettes a lot – my primary app-switcher just uses one keyboard shortcut, then it’s the first (or sometimes first two) letters of the app’s name, with a few exceptions (I use ff for fFirefox, for example).

However … I often find when I’m moving quickly, KM misses the second key press. So I’ll type s and will get the conflict palette for Safari, Skype, Spyder etc. after I type the second letter.

That said, KM conflict palettes are dead simple to set up. Eventually I’ll move the app switcher to Hammerspoon, without bothering to render the lists of apps (I know how to spell them :joy:) and I think the missed keystrokes will stop.

1 Like

Ah! I think I have unconsciously learnt a particular rhythm to the keystrokes, I did notice recently when I changed the first trigger it wasn’t working right somehow, then it settled in again. Thanks for the headsup on that though.
I am pleased to know there are aficianados of this. I will keep you in mind if I need some advice, their own forum is good of course. I only just realized a few weeks ago to be honest that there was another kind of palette to the conflict type, I didn’t understand how they worked I meant and didn’t realize sometimes I was using a kind of conflict palette. I only found out when I tried to change the colors.

1 Like

Ha, exactly the system I use. Not the Firefox ‘ff’ though. (edit) I try it out just now and my Keyboard Maestro works the same if I type as fast as I can. The is a sequence command + space, ‘a’, then ‘e’, works to open a set of tabs if I type them as fast as I can, and I type fast. It works before I even see the palettes in fact, consciously anyway. Maybe some Keyboard Maestro expert can pitch in?

Use BetterTouchTool. This is by miles the best (and most valuable) app I have purchased, even more than Alfred/KM/Hazel. I make shortcuts that are consistent across apps and even browser. Here’s an example:

  • ⌥ + F = Search. Search in finder, Search Text in Browsers, search in IDE, etc…all these apps usually have different shortcuts for search, does a specific search in evernote/obsidian. Some website, like discourse forums have started capturing ⌘ + F with their own search which I dislike so using ⌥ + F any does exactly what I want

  • ⌥ + D - Duplicates files in finder, duplicates tabs in browser, duplicates selected text in IDE or other text editors.

  • ⌥ + O - Open command pallete in VS Code, Obsidian, IDEs, evernote, performs Notes.app note search

The good thing is you only need to remember 10-15 shortcuts regardless of what the actual shortcut keys are for apps. You set it up in BetterTouchTool and that’s it. I have hundred of similar mappings across apps, but the shortcut is the same :slight_smile:

2 Likes

Paletro and similar apps give you keyboard access to menus in programs, so might be a good solution for some of the problems listed here.

2 Likes

Just in case you’re not aware: pressing ⌘ + F will revert you back to default search.

I know that’s the standard setup that everybody uses. I just don’t understand why. It makes sense if you’re not already using Karabiner, KM, BTT etc, but if you’re using yabai, you probably are, so why bring in yet another shortcut manager?

I thought this was really interesting and since it’s available on Setapp, I went ahead to install it… only to find that I already have it installed. LOL. Can absolutely not remember having tried it.

But when I open it now, I quickly see why I forgot about it. I don’t quite understand how to use it (or what exactly to use it for). It’s not intuitive to me. You have to actively learn it. But after your recommendation, maybe I’m more motivated to use it…

1 Like