1

Cmd-w closes the current window on MacOS Catalina. This conflicts with my muscle memory of using M-w in Emacs.

I looked at Disable Command-W in the terminal, but the accepted answer does not work on MacOS Catalina.

How do you disable Cmd-w?

1

Like in old versions, it be can't removed. The work around is the same: the system default can be overridden to a new key combination. The hotkey must be associated with a context menu item name (ie. an app specific menu item). The name must match exactly.

Systems apps use the name Close to mean close window, along with iTerm2. Some other apps use the more verbose Close Window. Remap both to get decent app coverage. Note that some apps may use other unique names that mean close window. Separate entries will have to be made for these apps to remap it globally.

Navigate to System Preferences -> Keyboard.

enter image description here

Select the Shortcuts tab, then App Shortcuts in the left pane.

Select the + at the bottom of the window to add a new shortcut.

enter image description here

To remap it globally, select All Applications in the Application field. To change Cmd-w on a specific application instead of globally, select that instead.

Set Menu Title to Close. It is case sensitive and must match exactly.

Set Keyboard Shortcut to the desired key combination. I set it to an obscure value so it's essentially 'disabled'.

Click Add to finalize the key shortcut. The right pane should now show a new entry for Close with your key combination (see the first image for an example).

Add another hotkey entry with Application set to All Applications and Menu Title set to Close Window for additional coverage.

Close the menu.

The change takes effect immediately, including with open apps.

5
  • 1
    That will only work in Apps where the menu item literally says 'Close', not for Close Window, Close Tab, .. etc Looking at the linked question, it pretty much says the same thing - you must have an exact match.
    – Tetsujin
    May 4 '20 at 7:25
  • That's not my experience. It appears to work on all apps, even when they do not list Close in their menu. May 4 '20 at 7:42
  • 1
    Empirically, it has long been proven not to work with 'contextual' menu entries. There are many questions on it - one example apple.stackexchange.com/questions/387276/… If you did get it to work, I'd love to know what's different from everyone else's experience.
    – Tetsujin
    May 4 '20 at 7:50
  • 1
    Ah, I see that all the apps I've tried it on have a Close option somewhere in their menus. It seems that "Close" is very common (including system apps). "Close Window" seems to be used with Chrome, which I assume is what is bringing a lot of readers. I'll update the response to reflect this. May 4 '20 at 8:00
  • 1
    Thanks for checking :) btw, you shouldn't need to re-launch an app to see the behaviour change, it should pretty much be 'live' as you change the control panel.
    – Tetsujin
    May 4 '20 at 8:13

You must log in to answer this question.

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