48

I never (intentionally) hide an app with H, which could be rebound for each app (e.g. Finder), but this is obviously the wrong approach. So, (how) can you disable H for application-hiding in one fell swoop? enter image description here

2
  • 1
    Man, I wish there was a way to do what the OP wants. Is there some kind of regex-like syntax to enable remapping "System" shortcuts in ~/Library/Preferences/.GlobalPreferences.plist, as the OP hinted at in the screen shot? The problem is that the shortcuts attach to menu item strings, but the quit and hide commands are always prefixed with the application's name :(
    – Mac Cowell
    Commented Mar 29, 2015 at 3:52
  • 2
    yeah dummest shortcut coming from windows where applications use shortcuts like this I press it by accident all the time
    – Brad
    Commented Jun 28, 2022 at 8:42

4 Answers 4

13

You might use a private.xml like this with Karabiner (formerly KeyRemap4MacBook):

<?xml version="1.0"?>
<root>
  <item>
    <name>test</name>
    <identifier>test</identifier>
    <autogen>__KeyToKey__ KeyCode::H, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
  </item>
</root>
2
  • 10
    What if I want to use the keystroke for something else? VK_NONE means that if you hit that key, apps see nothing happening.
    – user47093
    Commented Jul 7, 2015 at 15:05
  • 1
    Who answered this, i do not see the user? But either way this was freaking genius, i have hated this for so long. And have added several of these Hide {Stupid Thing} in System Prefs. No more finally. Thank you!!!!!!!!!!!!!!!! Commented Jul 30, 2015 at 11:27
13

If you do not want an approach for separate applications, but for TOTAL disabling of the shortcut, you can use Karabiner (FREE, and OPEN SOURCE :) ) and after installing it add a special complex modification rule

The link already contains the search query, so just look for Prevent unintended command-h hide window and then click on Import and you are done!

5
  • This is an interesting application, and the fact that it is open source makes it more interesting. Thanks!
    – Rafid
    Commented Sep 20, 2021 at 17:00
  • 1
    However, for some reason, I am not able to get the Prevent unintended command-h hide window (rev 2) rule to work. I imported it and enabled it, but Cmd-H still hides the window.
    – Rafid
    Commented Sep 20, 2021 at 18:11
  • 1
    @Rafid make sure to address any needed permissions for Karabiner. I had to update 2 or 3 different security settings before it worked for me. Karabiner lets you dismiss its dialogs as though these permissions are optional.
    – Mike B
    Commented Jan 31, 2022 at 7:07
  • 2
    But this will disable cmd+h not only for hide window but also for some applications' cmd+h shortcuts. Commented Oct 22, 2022 at 9:18
  • correct @ChangdaePark, this solution as it says is for "TOTAL disabling"
    – mPrinC
    Commented Nov 2, 2022 at 12:48
10

In addition to the accepted answer, this can be accomplished easily with BetterTouchTool.

Open BTT Preferences. If it isn't selected already, select Gestures.

Under Select Application, select Global.

Add a New Shortcut: H and leave the Trigger set to No Action.

BetterTouch Tool Gestures

Close the Preferences window, and H should now be disabled for all applications.

The downside compared to the accepted answer is that this fix involves running an application. However since many Mac users are already running BTT in the background for other purposes, this fix can be done in a few seconds and might be simpler for some users.

1
  • Update: Global is now called All Apps. (Otherwise, the solution is still good after all these years!)
    – Rhubarb
    Commented Nov 8, 2023 at 10:02
6

SKHD is a simple and neat hotkey daemon for macOS. It allows you to define application-specific bindings as well. You can configure a binding for your app to ignore a hotkey or even configure to send a new one instead.

For example, h hides Alacritty.app by default. You would synthesize an empty keypress as below in order to ignore that keypress.

Add following configuration to your .skhdrc. You can list any other app from your applications directory in a new line and do whatever you like.

cmd - h [
  "alacritty" : skhd -k ""
  "safari" : skhd -k ""
]

In my case, I prefer to synthesize a different keypress: b and then h which triggers my Tmux binding (jump to left pane).

cmd - h [
  "alacritty" : skhd -k "ctrl - b" && skhd -k "h"
]

Make sure to reload SKHD after editing config file.

❯ skhd --reload

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .