Create two keyboard shortcuts for same menu bar item

I want to use both CommandH and CommandW to hide Notes.app (relaunching Notes.app takes some time and I'm used to other applications not quitting when all windows are closed), but apparently in System Preferences > Keyboard > App Shortcuts I can only assign one keyboard shortcut to it.

Is there any way for me to assign both keyboard shortcut to the same menu bar item?


Is there any way for me to assign both keyboard shortcut to the same menu bar item?

Though normal methods I would have to say no, and I do not know of an abnormal method that would allow it either.



Alternate Solution

  1. Create an Automator Quick Action/Service with settings:
  • Workflow receives [no input] in [Notes]
  1. Add a Run AppleScript action, replacing the default code with:
tell application "System Events" to key code 4 using command down

Or use:

tell application "System Events" to set visible of application process "Notes" to false
  1. Save the workflow as, e.g.,: Hide Windows in Notes

  2. In System Preferences > Keyboard > Shortcuts > Services > App Shortcuts, add one for Notes and the Close menu title setting it keyboard shortcut to: ⌘U

  3. In System Preferences > Keyboard > Shortcuts > Services, set the keyboard shortcut for, e.g., Hide Windows in Notes to: ⌘W


Now when in Notes and you press ⌘W it hides the windows instead of closing the window.


Notes:

On some versions of macOS there is a bug in the naming convention of an Automator Quick Action/Service in that spaces cause the Quick Action/Service not to show in System Preferences > Keyboard > Shortcuts > Services. The workaround is to not use spaces in the name of the Quick Action/Service.

The example AppleScript code, shown above, was tested in Script Editor and an Automator Quick Action/Service under macOS Catalina with Language & Region settings in System Preferences set to English (US) — Primary and worked for me without issue1.

  • 1 Assumes necessary and appropriate settings in System Preferences > Security & Privacy > Privacy have been set/addressed as needed.

enter image description here