14

When I press commandH, the current window is hidden. I'd like to disable this shortcut, because I'm using it in another application.

I opened System Preferences -> Hardware -> Keyboard -> Keyboard Shortcuts -> Application Shortcuts -> All Applications

I tried adding "No Action" as MenuTitle and commandH as KeyboardShortcut (see screenshot below).

screenshot

But this doesn't work.

What am I doing wrong?

Edit: What solved my problem was assigning shortcut commandOptionShiftH to actions like "Hide Eclipse". Since I never press this key combination, this action never gets executed.

  • That won't override an existing command. As every app has a different command for Hide, e.g., Hide Safari, Hide TextEdit, etc., you can't do it that way either. You'll need something like Karabiner or BetterTouchTool – Tetsujin Feb 21 '16 at 13:47
11

Adding an answer based on the Edit: above as it took me a while to figure this out.

If you want to disable the -h shortcut you have to do it per-app.

First open the app, and confirm from the preferences what text option the shortcut is mapped to.

Using Kitty.app as an example, for me it's Hide kitty.

Original Kitty Preferences Screenshot

Then you open System Preferences and go to Keyboard -> Shortcuts -> App Shortcuts and then click +.

Limit it to the relevant app, enter Hide <yourappname> (e.g. Hide kitty in my case), and pick an obscure key combination. I use the section symbol because it's not in my default layout so I won't type it by mistake.

System Preferences Screenshot

Now when you click on the Application's menu, you should see your new shortcut has been set, and -h will no longer hide that application.

Kitty Menu after changing the shortcut

Unfortunately there doesn't seem to be a way to do this for all apps.

See also this Apple Support Page

  • This might be obvious, but how are you supposed to actually type the section symbol into the shortcut field? You can't use option+6 because it'll just map the shortcut to that combination. – taylorthurlow Nov 1 '18 at 19:18
  • @tay It was possible for me to make that combination on my UK layout keyboard, it might not work for you – gib Nov 5 '18 at 14:48
  • @taylorthurlow you can just choose any shortcut you won't accidentally press (e.g. Cmd-Control-Option-Shift-). It can also be done via the command line. – gib Nov 5 '18 at 15:05
  • 2
    Awesome. Ironically, I was trying to disable that precisely for kitty – Cristian Mar 12 at 1:15
3

Adding yet another option:

If you use the Karabiner app (extremely useful in its own right -- for example, you can add VIM-style navigation with Ctrl+h/j/k/l, or map the Escape key to Caps Lock), there is a "Complex Modification" that disables command-h window hiding. Install the app and see the listing: Prevent unintended command-h hide window on this page.

2

another way to do this is to use BetterTouchTool and define a global keyboard shortcut which maps Command-H to no-action.

No app restart required.

See: BetterTouchTool

This tool is also useful to restore the original behavior of the red/orange/green window decorations in OSX

The downside is that this requires a license ($6.50 at this time)

  • May be worth mentioning that this isn't free and only provides for a 45 day trial. – Evan Carroll Mar 26 at 17:51
0

The (very non-ideal, but functional) way that I solved this problem is to use Alfred to define a global hotkey mapping CommandH to nothing. You could use any app capable of defining global hotkeys to do this (ex. BetterTouchTool or KeyboardMaestro).

Here's the Alfred workflow that I used: My Alfred Workflow, which just registers global hotkeys for CMD-H and CMD-SHIFT-H and does nothing with them

0

Overriding keyboard shortcuts Via macOS Terminal

In this example, I change the "Open Viewer" menu option in Apple Photos to "Space", like it used to be pre-2017:


defaults write com.apple.Photos NSUserKeyEquivalents -dict-add "Open Viewer" -string " "

Reset to defaults:

defaults delete com.apple.Photos NSUserKeyEquivalents

Change the global shortcut for "Preferences" to "⌘ + p" (the "-g" option means "Global", and "@\" translates to "⌘"):

defaults write -g NSUserKeyEquivalents -dict-add "Preferences" -string "@\\p"

A word of warning though: Do not paste this into your Terminal window if you don't feel comfortable with altering the default settings of macOS apps, or if you don't fully understand what it means.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.