Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
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 '10 at 0:45
    
I realize I forgot the HIG reference: developer.apple.com/Mac/library/documentation/UserExperience/… –  fideli Feb 6 '10 at 0:48
1  
for completeness, the official list of finder shortcuts from Apple support.apple.com/kb/HT1343 –  Jeff Atwood Feb 6 '10 at 9:59
    
Anyway to apply a color label via keyboard shortcut? –  macek Feb 8 '10 at 19:10
add comment

6 Answers 6

up vote 18 down vote accepted

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.

share|improve this answer
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 '10 at 19:07
    
The Preferences requests a 'Menu Title'. What's the 'Menu Title' for the 'context menu'? –  kilaka Nov 22 '12 at 10:08
add comment

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.

share|improve this answer
add comment

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).

share|improve this answer
add comment

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.

share|improve this answer
    
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 '10 at 19:21
add comment

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.

share|improve this answer
    
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 '10 at 19:09
add comment

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: http://stackoverflow.com/a/11238186/1919382

share|improve this answer
    
I posted this answer on two similar questions, I do know the policy on this, but here are the sources: Ask different - OS X right click/context menu via keyboard and here Ask different - How do I open the context menu from a Mac keyboard? –  CousinCocaine Sep 10 '13 at 16:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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