osx - How to add a custom keyboard shortcut for a nested menu item?

23
2013-10
  • username

    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:

    a) the menu is nested?

    or

    b) there are two menu items with the same name that do different things?

    FYI: the particular reason I'm looking for this atm is because I want a quick way to show/hide the bookmark bar in Firefox (eg: instead of pressing the jelly bean in the top right of the screen). I'm using a small display so it would be convenient.

  • Answers
  • Doug Harris

    There's a known bug with Firefox for Mac not obeying shortcuts. There's more discussion in a different question on SuperUser.

  • Lauri Ranta

    You can specify the shortcuts like Format->Indentation->Increase in 10.8, or >Format>Indentation>Increase in 10.7.

    Firefox still doesn't support custom shortcuts though. 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

  • John T

    I'd recommend using Spark along with AppleScript, since AppleScript can control Finder.

    Spark is a powerful and easy shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScripts, command iTunes, and more...


  • Related Question

    OSX Keyboard Shortcuts in Dialogs?
  • Dan Fabulich

    On Windows, every dialog box includes underlined letters that you can activate using the Alt key. I use these "Alt" keyboard shortcuts all the time; I'm missing them as I'm trying to switch to OSX.

    On OSX, all I can find is Tab navigation, which requires you to press Tab seven or eight times to get anywhere in most dialog boxes. (And even that is hidden by default: you have to enable "Full keyboard access" in the "Keyboard & Mouse" control panel to be able to Tab between buttons.)

    Is there some way I can get something like the Windows Alt accelerators for OSX dialogs? I'm willing to write Automator code, download/purchase software, etc.

    Specifically, I'm imagining maybe something where you do some shortcut command and then start typing the name of the button, and hit Enter to push the button...?


  • Related Answers
  • Al Everett

    In OSX there's no such thing as the "_" for dialogs like in Windows. However, you have:

    esc → defaults to no/cancel

    cmd + deldon't save (cmd + d before OS X Lion)

    entersave/OK

    spacebarclick selected button (use tab to move).

    A quick Google search for "osx keyboard shortcuts" will teach you way more than you can memorize in one day, but you should; there are dozens and some are very valuable.

    You can always add more/change some existing ones by going to System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts, exactly where you activated "all controls".

    But as far as I know, there's no "underscore" thing in OSX.

  • XP84

    In addition to Martín's essential list of shortcuts (which work almost everywhere), you should know that in a File Open or File Save dialog you can press / or ~ to jump straight to a popup sheet that will let you type in a folder path. This is great for if you are a super fast typist, or if you want to go to a hidden folder like ~/.ssh.

    That field even does Tab Completion, sort-of—the catch is if there are zero matches, or more than one match, when you press Tab, instead of doing any kind of completion Tab will just jump you out of the text field.

  • javadba

    This is not possible in OS/X. And a key reason I do not prefer Macs.

    The OP points out a critical failing in OS/X: the ability to rapidly - and with only the keyboard - select any entries (not just "OK / cancel", etc) in a dialog box. None of the suggestions above can do that.

    A common example is: within a Find/Replace dialog I want to change from Case Sensitive to Case Insensitive. In Linux (and in windows) I can achieve that using only keystrokes. This is not possible in MAC: you have to use the mouse or fumble around with tabbing multiple times.