27

I'm sure most of us here like doing thing as efficiently as possible and therefore we're a bunch of keyboard junkies.

With a file (or group of files) highlighted, is there a way to open the context menu (equivalent of right-click) with the keyboard?

4
  • 4
    You may be better off learning or setting keyboard shortcuts for items in the regular menu bar, as the contextual menu likely is a subset of those actions. Apple Human Interface Guidelines state: Always ensure that contextual menu items are also available as menu commands. Therefore, I think it would be redundant to try to use a keyboard shortcut for the contextual menu. Having said that, people have tried various ways, with little success that I know of. forums.macosxhints.com/showthread.php?t=91915
    – fideli
    Feb 6, 2010 at 0:45
  • I realize I forgot the HIG reference: developer.apple.com/Mac/library/documentation/UserExperience/…
    – fideli
    Feb 6, 2010 at 0:48
  • 1
    for completeness, the official list of finder shortcuts from Apple support.apple.com/kb/HT1343 Feb 6, 2010 at 9:59
  • Anyway to apply a color label via keyboard shortcut?
    – macek
    Feb 8, 2010 at 19:10

8 Answers 8

18

Short answer: no.

Most items in the Finder’s context menu are already accessible via the menu bar & any thing in the menu bar is fair game for a custom keyboard shortcut in System Preferences (System Preferences > Keyboard > Keyboard Shortcuts > Application Shortcuts). You can assign keyboard shortcuts for most apps (Firefox excluded) in that panel and that includes the Finder. If it doesn’t immediately take effect, just relaunch the Finder.

3
  • 1
    I'm really trying to apply a color label to specific folders and files with the keyboard. This is still useful information, thank you.
    – macek
    Feb 8, 2010 at 19:07
  • The Preferences requests a 'Menu Title'. What's the 'Menu Title' for the 'context menu'? Nov 22, 2012 at 10:08
  • This doesn't work for Open With (at least for me, on 11.4): when looking at the File menu I do see that Open With has been assigned the shortcut key I chose, but still nothing happens when I press it (well, not nothing: the File menu title is highlighted momentarily. But the Open With menu is not opened).
    – Tom
    Jun 12, 2021 at 5:42
7

Quicksilver proxy objects, specifically the "Current Selection" proxy object.

This will let you invoke Quicksilver with all of the items you have selected in the Finder as the thing you do stuff to.

I have a trigger (mine's set to ⌘+shift+space) set up to get all the currently-selected items in the Finder. The end result is that I can perform actions on the currently-selected items in the Finder with, like, three keystrokes. Most of the things I can do to the items are in the context menu, but not all, if I recall. Still, pretty handy.

6

Not quite exactly the context menu, very close however. If you use the commands for Universal Access you can get to the menu for the Task button in the buttonbar.

Press control-F5 to put the focus on the buttonbar. Press tab until the Task button is highlighted, press space to open it, use the arrows to make your selection.

Note that you may have to enable Universal Access, and that you can change the control-F5 shortcut in the Keyboard prefpane. Also, the name of the button may be slightly different in English (I'm running in Dutch, and can't be bothered to switch languages to check the exact translation).

1
  • Just to update that currently (11.4) Universal Access is called Accessibility and the relevant options are there under Pointer Control.
    – Tom
    Jun 12, 2021 at 8:11
4

This answers the more specific question in your comment to your original question. It could probably have been a new question since it is much more specific.


To set the “Color Label” of the currently selected files, you can combine an AppleScript program (or a shell program that uses osascript) with any of the multitude of “launcher” applications (Quicksilver, FastScripts, etc.) that can run AppleScript programs (or shell programs) based on a shortcut key combination.

For any of the scripts below, paste them into Script Editor / AppleScript Editor and save them in “script” format (or whatever format your chosen launcher uses). The usual place for such saved scripts would be ~/Library/Scripts/Applications/Finder, but, depending on your launcher, you could use other locations.

Here is a simple version that you can hard-code to any one of the labels:

on run
    tell application "Finder"
        repeat with anItem in (get selection)
            (*
             * 0 - none
             * 1 - Orange
             * 2 - Red
             * 3 - Yellow
             * 4 - Blue
             * 5 - Purple
             * 6 - Green
             * 7 - Gray
             *)
            set label index of anItem to 4
        end repeat
    end tell
end run

If you only have a couple of labels that you use, you might save a couple of copies of this and bind a key to each copy.

Here is a version that always prompts you for which label to apply:

on run
    tell application "Finder" to set selectedItems to selection
    if length of selectedItems is 0 then
        display dialog "Select some items in Finder before running this program." with title "Apply Finder Label to Selected Items" buttons {"OK"} default button {"OK"}
        return
    end if

    set labels to prependIndicies(getLabelNames())
    set default to first item of labels
    set labelIndex to choose from list labels default items default with prompt "Choose label to apply to selected items" without empty selection allowed and multiple selections allowed
    if labelIndex is false then return
    set labelIndex to (first word of first item of labelIndex) as number

    tell application "Finder"
        repeat with anItem in selectedItems
            set label index of anItem to labelIndex
        end repeat
    end tell
end run

to getLabelNames()
    set labelNames to {"Orange", "Red", "Yellow", "Blue", "Purple", "Green", "Gray"}

    set useCustomLabelNames to true -- change to false if this is too slow or does not work for you
    if useCustomLabelNames then
        set cmds to {}
        repeat with i from 1 to 7
            set end of cmds to "defaults read com.apple.Labels Label_Name_" & (8 - i) & " || echo " & quoted form of item i of labelNames
        end repeat
        set text item delimiters to {";"}
        set labelNames to paragraphs of (do shell script (cmds as text))
    end if
end getLabelNames

to prependIndicies(theList)
    repeat with i from 1 to length of theList
        set item i of theList to (i as text) & " - " & (item i of theList)
    end repeat
    {"0 - none"} & theList
end prependIndicies

When the dialog appears, type one of 0-7 to select a label, then hit Return to apply it to the items selected in Finder.

1
  • You're right, this is nearly a whole separate question. I accepted the answer that targets the original question better, but I still voted this one one. I will give this a shot later tonight. Thanks, Chris :)
    – macek
    Feb 9, 2010 at 19:21
2

The context menu can primarily be opened by a right mouse click only. But in the Universal Acces settings in the System Preferences we can control mouse keys by using the keyboard number pad. When activated, a right mouse click then can be achieved by Ctrl-5 on a keyboard with a numpad or Fn-Ctrl-I on a laptop. This will allow you to 'right-click' your word.

Go to System Preference --> Universal Access --> Mouse --> Enable Mouse Keys (ON)

Found on: https://stackoverflow.com/a/11238186/1919382

2
1

Cmd + Shift + / will invoke the help menu at the Menu bar. If you're aware of the item name in context menu, you can type it there and hit enter when appropriate entry is highlighted.

3
  • This doesn't work with Open With (at least for me, on 11.4) – it simply shows the File menu, highlighting where Open With is, but I still can't invoke the functionality without the mouse.
    – Tom
    Jun 12, 2021 at 5:39
  • @Tom Could you tell me what are you trying to open and in which application? I'm on 11.2 and it works for me. I'm in finder and a image is selected. With the above combination help window opens and if I type preview and hit enter, the file opens in preview. Jun 12, 2021 at 5:53
  • 1
    You're right! I was hoping to just type "open with" and to get the Open With menu, and this didn't work. But I don't actually need the Open With menu - I get all the sub-options in the help menu already, and can open what I need from there!
    – Tom
    Jun 12, 2021 at 6:14
1

Expanding to @JohannKool's answer, it helps to reorganize the toolbar. Making the Action item to be the first item in Finder toolbar, one gets instant access to it by just pressing Control + F5 once.

  • If the Finder toolbars are hidden, first activate them by choosing View > Show Toolbar from the Finder menu or press Option + Command + T.

  • To place the Action item to the beginning of the toolbar, choose View > Customize Toolbar

    Customize Toolbar

  • Drag the Action item to the frontmost position. To rearrange items, one may need to press and hold the Command key while dragging.

    Drag Action item to be the first item

  • Back inside a Finder window, select a file and press Control + F5 to activate the Action item in Finder toolbar. Then use Arrow keys to navigate through Action item menu. Navigate with Arrow down to a sub menu like Open With and then use Arrow right to enter the submenu. Arrow left gets one back to Action item main menu. By pressing Enter, a menu item is getting executed, e.g. opening the selected Finder item(s) in a non standard app. To leave the Action item menu, just press Esc key.

    Action item menu is similar to Context menu

  • If this doesn't work, check System preferences > Keyboard > Shortcuts > Keyboard. Move focus to the window toolbar Control + F5 needs to be selected and Full keyboard Access needs to be set to All controls.

    Configure System Preferences to make this shortcut work

  • Finally in System preferences > Keyboard > Keyboard, there is an option to press fn key for accessing standard Function keys like F5 or not. This means, the shortcut for accessing Action item Control + F5, could possibly be Control + F5 + fn for some users. That shortcut can also be setup to one's liking, e.g. without a Function key. This comes in handy, especially if no real Function keys are present on Touch Bar Macs anymore.

Although this won't activate the real Context menu by keyboard shortcuts, Action item should contain the desired functionality, too. This is tested to work on OS X 10.9.x through macOS 10.14.x.

0

I do not know of a way to open the context menu for the current selection (which is what I think you really want) but you can “right click” whatever whatever is under the mouse pointer with only the keyboard.

Turning Sticky Keys and Mouse Keys on or off

Shortcuts for Mouse Keys

  • Activate Mouse Keys.
    • In System Preferences, search for “mouse keys” and turn it on.
      • You can also choose to have five presses of Option toggle Mouse Keys.
  • Position the mouse cursor.
  • Hold Control.
  • Press and release the keypad's 5 key (or Fn+I (not L, the one between U and O)).
  • Release Control.

But, this relies on having the mouse pointer properly positioned. If you have selected the files in Finder without using the mouse then the mouse pointer will likely be somewhere completely unrelated to your Finder task.

2
  • 1
    I appreciate the help, but positioning the cursor defeats the purpose of a keyboard shortcut. I'm trying to SKIP the repeated slow task of targeting files with my mouse before I can right-click them. That is, files are already selected via keyboard, I don't want to target them twice.
    – macek
    Feb 8, 2010 at 19:09
  • Whatever happened to ctrl-click?
    – user1019780
    Apr 2, 2020 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.