Skip to content

Instantly share code, notes, and snippets.

@daz
Forked from vitorgalvao/Right Click.applescript
Created August 23, 2020 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daz/2c08b81ada1b920fc94147db2a5638f7 to your computer and use it in GitHub Desktop.
Save daz/2c08b81ada1b920fc94147db2a5638f7 to your computer and use it in GitHub Desktop.
Make right-clicking on OSX accessible via a keyboard shortcut.
(*
Even though a [native solution][1] exists, it still suffers from a big flaw: it right-clicks the place you cursor is, not what you’re selecting. This addresses that limitation.
You can install this as a [Finder Service, and later asign it a keyboard shortcut][2].
[1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os
[2]: http://www.macosxautomation.com/services/learn/tut01/index.html
*)
tell application "System Events" to set frontApp to name of first process whose frontmost is true
if (frontApp = "Finder") then
tell application "System Events"
tell application process "Finder"
set _selection to value of attribute "AXFocusedUIElement"
tell _selection to perform action "AXShowMenu"
end tell
end tell
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment