6

I want to right click where the focus is not where the mouse cursor is (eg. the blinking text cursor or on a file) using only the keyboard.

I've tried mouse keys and it right clicks at the mouse pointer, not the text cursor. I'm open to any 3rd party apps or services.

3
  • 2
    Just to clarify, are you looking for functionality on OS X to open up the context menu similar to the Windows Menu key?
    – fideli
    Commented Mar 2, 2011 at 1:22
  • 2
    Most likely, all commands in the context menu are available from the menubar. Press Cmd-? to open Help menu's search field and type your command instead, or use Ctrl-F2 to move the focus to the menu bar and navigate to your desired action there. Or better, assign keyboard shortcuts to often used commands in System Preferences » Keyboard » Keyboard Shortcuts » Applications so you can access them directly.
    – Daniel Beck
    Commented Mar 2, 2011 at 6:44
  • For how the Help search field can work, see here.
    – Daniel Beck
    Commented Mar 2, 2011 at 6:57

3 Answers 3

3

This is a common request of ex-Windows Keyboard Maestro users. Apparently there is a window key which will display a contextual menu based on the insertion point, but there is no equivalent behaviour on the Mac. It is impossible in general to get the screen location of the current insertion point (some applications may allow some method via AppleScript or Assistive services).

So there is no way to move the mouse pointer to the insertion location in general, and the contextual menus are based on the mouse pointer.

This is why Keyboard Maestro doesn't implement this, and without some low level hackery, it is almost certainly impossible.

So essentially you are out of luck. You will need to find an alternative solution to your issue.

0

There could be at least two ways to do it:

  • Using a direct action for opening the context menu
  • Moving the mouse pointer over the selected items or text, and then triggering a secondary click

But I haven't found a way to do either of those.

Applescript is pretty crappy at working with both selections and mouse stuff. Keyboard Maestro, iKey, QuicKeys or BetterTouchTool don't seem to have any way to do it either. Or MouseTools or XTool.osax. Or KeyRemap4MacBook.

0

I see that @Peter N Lewis's answer from 2011, it's not possible, has already been marked as the accepted solution.

A suggestion was posted to the Keyboard Maestro Forum (https://forum.keyboardmaestro.com/t/move-mouse-cursor-to-text-cursor-position/2232/3) by user sancarn in 2015 which may help if you have Keyboard Maestro available and thus can use its "Click at Found Image" feature:

Have your macro type a “§”. Now you can search the document for the “§” character (either with images or maybe there’s a better way?). Double click on that position then right click on said position. There might be better pictures you can use (like the apple logo ?). Messy work around but it could work! :slight_smile: (Note: I think that may be dependant on font size actually…)

From my experience with Keyboard Maestro's Click at Found Image tool/function/action, yes, you will have to know the font size and colors of the target image and save that either in a file or within the macro definition. If you can narrow down the image search region (easily specifiable in Keyboard Maestro) so that you are searching within as small an area of the screen as possible (e.g. the right half of the middle third of the front app window), that will improve both speed and accuracy of such a macro.

Such a solution may not work for you in your specific use case. I've been looking for a similar solution and this is the best I've found so far (as of 7/2024).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .