18

On my keyboard layout, the M key is right next to the W key:

Dvorak keyboard with adjacent m and w keys circled

This can be problematic at times because occasionally I will accidentally press Command-M instead of Command-W, causing the window to be minimized rather than closed.

Since there's no keyboard shortcut to un-minimize a window (well ok, no easy keyboard shortcut), this is even more annoying because then I have to switch to my trackpad to un-minimize the window and then try again to close it.

Is there a way to disable the Command-M shortcut for minimizing a window?

1
  • i truely hate this feature Jul 21, 2022 at 14:00

6 Answers 6

23

You can disable it by editing ~/Library/Preferences/.GlobalPreferences.plist:

defaults write -g NSUserKeyEquivalents -dict-add 'Minimize' '\0'

To apply the changes you have to reopen applications. If the shortcut was assigned to nil, pressing L would trigger it in Audacity.

5
  • This didn't work for me on Yosemite. I could do it with this answer. Nov 20, 2015 at 22:54
  • Works. FTR, to the original setting (if you want to revert it) is NSUserKeyEquivalents { Minimize = "@$m"; }
    – Jakub M.
    Feb 25, 2016 at 6:43
  • Unfortunately Firefox 60.x does not honour this :(
    – Tilo
    Jun 16, 2018 at 22:59
  • Thank you! This still works in 2023 on my M1 running macOS 13.2 Jan 26, 2023 at 14:11
  • How do you modify that file? Opening in text editor shows plenty of weird characters. May 30, 2023 at 17:32
4

You can "override" the default Command-M shortcut by mapping it to something else. To remap the key combination, launch System Preferences and choose Keyboard. Then the Keyboard Preferences Panel appears, click on the right tab named "Keyboard Shortcuts". You will notice many default keyboard shortcuts that you can override.

I've tried remapping Command-M using this method and it works.

1

Remapping Command-M to Zoom in "All Applications" seemed to be a good workaround as Zoom appears in all applications and doesn't have nearly as disruptive an effect as an unintentional Minimize.

I was going to try the terminal command above so I went to remove the command M for Zoom and lo and behold, Minimize was now listed with no key command. So I just left it that way, now command-M does nothing and minimize lives harmlessly in the Menu. No terminal command necessary.

1

You can remap any key and key combination with the wonderful and free software Karabiner. After installing, just add the following code to your ~/Library/Application Support/Karabiner/private.xml:

  <item>
    <name>Map Cmd-M to Cmd-Alt-M</name>
    <appendix>Changes the minimize shortcut</appendix>
    <not>EMACS</not>
    <identifier>private.kill_m</identifier>
    <autogen>__KeyToKey__ KeyCode::M, ModifierFlag::COMMAND_L|ModifierFlag::OPTION_L, KeyCode::M, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::M, ModifierFlag::COMMAND_L, KeyCode::VK_NONE</autogen>
  </item>

  <item>
    <name>Map Cmd-Q to Cmd-Alt-Q</name>
    <appendix>Changes the quit shortcut</appendix>
    <not>EMACS</not>
    <identifier>private.kill_q</identifier>
    <autogen>__KeyToKey__ KeyCode::Q, ModifierFlag::COMMAND_L|ModifierFlag::OPTION_L, KeyCode::Q, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::Q, ModifierFlag::COMMAND_L, KeyCode::VK_NONE</autogen>
  </item>

Then klick "Reload XML" in the Karabiner preferences and set checkmarks for the new items.

This way the minimizing shortcut is not entirely disabled but still available with the additional option key: Cmd+Option+M or by simply using the right command key: Cmd (right)+M.

Note that the second part also changes the Cmd+Q shortcut to Cmd+Option+Q for your convenience. You can omit the second item, if you don’t need it.

1

You can "reset" the shortcut assigned to Minimize by adding a new shortcut in System Preferences>Keyboard>Shortcuts>App Shortcuts. Just press the plus button, specify the name of the menu title (in this case "Minimize"), press a new shortcut and confirm with "Add".

Note that the name of the menu title must be an exact match. If other users on your Mac use a different language, or some of your apps are in another language, you will need to create shortcuts for all of those languages.

For example, if both Korean and English are used on your Mac, you will need to create two entries, one for each language:

enter image description here

0

There's a handy keyboard layout called "Dvorak - Qwerty⌘". It's basically Dvorak, but it flips the layout to QWERTY while the ⌘ key is held down. It was designed so that people who want to learn Dvorak don't have to retrain their hotkey muscle memory, but it could help you too.

1
  • Too late; I've completely forgotten QWERTY by this point ;)
    – user5118
    Nov 30, 2014 at 18:49

You must log in to answer this question.