39

This has been bugging me for a couple years now. So in Mac OS X you can assign your own Keyboard Shortcuts (in System Preferences > Keyboard > Keyboard Shortcuts) by typing in the exact name of the menu item to which you intend to bind the keystrokes. So what are you supposed to type if:

  • the menu is nested? or
  • there are two menu items with the same name that do different things?

I don't care about special cases like Firefox. Please don't mention special cases, unless this is a special case where Apple failed it.


  • Example with Terminal: Shell > New Tab > Pro and Shell > New Window > Pro. I was using this as an example. I can't imagine that Terminal is the only app with this design flaw.

  • Another example from Pages: File > Duplicate and Edit > Duplicate. If you want to make Command-D duplicate, it'll set it for the edit menu but when that document gets locked, only the file menu has the option for duplicate, the edit menu is greyed out and the shortcut is locked to the unaccessible one.

slhck
  • 228,104
Jim
  • 528

2 Answers2

40

You can specify the shortcuts like Format->Indentation->Increase in 10.8 (thanks @JohanKaving), or >Format>Indentation>Increase in 10.7.

Another option would be to assign a shortcut to a script like this:

tell application "System Events" to tell process "Terminal" to click menu item "Pro" of menu "New Window" of menu item 1 of menu "Shell" of menu bar 1

Lri
  • 41,444
  • Thanks for the hint!
  • Did this ever work with 10.6?
  • I still use 10.6.8 and tried it with your syntax and some modifications -- ">" at the beginning or not, separators with spaces or not " > ", etc) -- but none worked. :-(

    – porg Nov 28 '12 at 17:34
  • I think it was added in Lion but removed in Mountain Lion. There was a bug where you couldn't assign shortcuts to menu items that contained >. – Lri Nov 28 '12 at 20:32
  • So no chance for this functionality in 10.6.8 ? – porg Nov 29 '12 at 03:02
  • 8
    Ir seems as if this functionality has not been removed in Mountain Lion - but it has changed. It works for me if i specify it as Format->Indentation->Increase – Johan Kaving Jan 21 '13 at 14:54
  • 3
    I can confirm that Format->Indentation->Increase still works in v10.11. And what a tremendous boon it is. – TransferOrbit Oct 10 '15 at 06:25
  • 2
    This works, even for complex examples. For example, this works for me in macOS Catalina: Develop->Open Page With->Firefox.app (77.0.1) – David J. Jun 18 '20 at 17:27
  • 2
    -> syntax still works on MacOS 12.3 – Gavin Apr 04 '22 at 18:28
  • Used in 12.6 for Finder:

    View->Sort By->Date Created ⌃⌥⌘8

    View->Clean Up By->Date Created ⌥⌘8

    [Note you must include the root menu item (View in this case)]

    – rdela Sep 26 '22 at 21:41