69

I am looking for a keyboard shortcut to raise a context menu using Ubuntu on a MacBook pro. Pressing the keyboard shortcut should have the same effect as right-clicking at the cursor location.

On Windows keyboards, there is a dedicated button for this near the space bar. I have also read about using Shift+F10 or Ctrl+Space, but these have no effect on my system.

A.B.
  • 92,125

9 Answers9

72

Shift+F10 worked in my case. I guess the need of Fn depends on the keyboard you are using.

P.S. I used this combination on a file in Nautilus (Ubuntu 14.04 LTS).

Fabby
  • 35,017
curi0us-m0nkey
  • 962
  • 9
  • 11
37

The keysym to trigger the context menu is called Menu. It can be bound to an arbitrary keycode like this:

$ xmodmap -e 'keycode 68 = Menu'

Can be manually triggered from the command line like:

$ xdotool key Menu

And to find out the keycode it is currently bound to one can do:

$ xmodmap -pke | grep Menu

To figure out what keycode a key emits one can use:

$ xev
Grumbel
  • 4,879
12

Try Shift+Fn+F10. This works on Windows and Ubuntu in VirtualBox on OS X for me.

curi0us-m0nkey
  • 962
  • 9
  • 11
pratnala
  • 749
5

I generally use the basic: Ctrl+F10

Sooth
  • 151
4

Make sure you have a package named xdotool installed.

Make this application shortcut for the key of your preference:

xdotool click 3

Unfortunately this does not work on some applications, but seems to work on chromium-browser and firefox.

Bonus: For middle click the command is

xdotool click 2

Making application shortcuts for keyboard may vary according to the desktop environment used. In Xfce (used in e.g. Xubuntu) making such shortcuts happens easily in Keyboard dialog.

jarno
  • 6,175
3

Some combination of: (shiftorctrl)+(F10orFnF10), the shifts and ctrls on the left of the keyboard should be used.

If you want the application context menu in Raspbian Pi Linux: alt+space

Context key sometimes works: context key button on some keyboards it is the one with the list and mouse pointer

xxjjnn
  • 1,917
  • 2
  • 14
  • 12
1

My solution was to find an old 2-button mouse and plug it in.

I tried all the answers I saw above. Most seem to ignore part of the problem, which is that mac keyboards do not have alt or the windows key, in addition to the mouse not having two or more buttons.

I also did not understand what they expected the cursor/mouse to be doing while you hit shift-f10 or whatever. I want to lock an icon to the launcher, there is no way to select it first and then hit some key sequence. I can hover over it, or I can left-click it. Left-click and hold, then key sequnce while holding? Doesn't seem to work.

The answer above with xmodmap and xev commands seems like it might point in the right direction. But It's more like a "the solution exists" rather than an actual solution. Which key can I remap without messing things up? Shift-f10 seems to do nothing now, how would I use xmodmap to map menu to shift-f10? At least it provides a place to start the web search.

Also, the menu that comes up when I invoke "xdotool key menu" while hovering the mouse over something is not the same menu that comes up when I right-click on the same item. So "menu" is not quite what the OP asked for.

Dave
  • 11
0

On my system (Ubuntu 18.04):

$ xmodmap -pke | grep Menu
keycode 135 = Menu NoSymbol Menu NoSymbol Menu

This is a Lenovo laptop. The laptop's built-in keyboard has a meny key between Right AltGr and Right Ctrl that triggers the context menu. A Logitech external keyboard that I use does not have a separate menu key. On that keyboard the combination Fn+Right Ctrl triggers the context menu.

codeape
  • 647
0

The keybinding for Mac is CTRL+SPACE. This should open the right click or "context menu".

For linux, the combo is supposed to be CTRL+F10 and as stated, you may need to toggle or hold down the fn key as well.

However, you have mentioned, this does not work.

So, you may need to use the set keybinding for Mac instead as you are running linux on a Mac instead of a PC.

Click here for more info and a more complete list of keybindings.

mchid
  • 44,904
  • 8
  • 102
  • 162