I'm running Ubuntu on a Macbook Pro. How do you right-click using the keyboard in this setup? I've read that holding down the command key simulates pressing the "context menu" button on a Windows machine, but this behavior doesn't seem to be present in Ubuntu. I also don't see any way to configure this in Ubuntu's keyboard shortcut preferences dialog. Is there anyway else to do it?

Following JJ Stiff's answer, I tried installing xbindkeys and adding to my ~/.xbindkeysrc:

"sleep .05 && xdotool click 3"
  m:0x50 + c:134

Running xbindkeys -k and pressing the right command key reported that the code for the right command key is m:0x50 + c:134, thus the entry above.

However, when running xbindkeys -v, pressing the right command key still has no effect.

  • 1
    On the Mac it's natively the ctrl key, not command. The command key will translate to the "super" key in X terminology.
    – bahamat
    Jul 20, 2012 at 0:38

3 Answers 3


Shift + F10

I really want to but I don't know how to customize this. Perhaps with xbindkeys?

  • 2
    Actually, it's Fn+Shift+F10.
    – Cerin
    Jan 1, 2014 at 1:22
  • 2
    @Cerin Fn would only be necessary if your F10 key wasn't actually an F10 key...
    – NReilingh
    Jan 4, 2014 at 7:28
  • @NReilingh, Yes, by default it's the mute key. Thus my comment.
    – Cerin
    Jan 4, 2014 at 12:12
  • 3
    @Cerin But that's user-specific. The application is just looking for shift+F10. The way your system is configured, you send an F10 by hitting Fn+mute.
    – NReilingh
    Jan 4, 2014 at 20:18
  • 1
    Good shortcut; unfortunately, it corresponds to a right-click on the active window, not where the mouse is pointing. Aug 9, 2017 at 17:39

Scroll down to Steps, to see the solution.

Okay. Got it. Here's a solution to make apple-click (command-click) work as right-click. I also include apple-shift-click to work as middle-click. And I have added shift-delete to act as del rather than as BackSpace. This solution requires xbindkeys and xdotool.

Running Ubuntu Desktop 13.10 on MacBookPro2,2. For those that forgot, the MacBook Pro only has one mouse button. While it is supporting two-finger scroll out-of-the-box, there does not appear to be any way to right-click on ubuntu (out-of-the-box) on a macbookpro (without an external mouse). Apparently option-(Fn-)F10 is one almost-workaround, but it is not quite the same.

Since the original post, these combinations were tried but are not quite acceptable:

  • control + b:1 - ctrl-click enables multiple selections in the file manager and elsewhere.
  • option + b:1 - option (alt) provides functions in ubuntu which inhibit option-click from working.
  • shift + b:1 - shift-click is also a problem due to file selection.
  • control + option + b:1 - ctrl-option-click Sometimes requires a double mouse click, possibly because of ubuntu's use of option (alt).

The current recommendation is for apple-click; it seems to work well even though apple (command) (also called Super) does bring up the Keyboard Shortcuts window:

  • Mod4 + b:1 - xdotool click 3
  • Mod4 + shift + b:1 - xdotool click 2
  • shift + BackSpace - xdotool key --clearmodifiers Delete #Note: does not auto-repeat.

Note: I have found the need to sleep before running xdotool from xbindkeys: .05 is okay for xdotool click but .10 is required for xdotool key. [I lowered it to .04 and .07, with success.] (May I have an explaination please? My assumption is that xbindkeys and the system need to finish handling the current event before xdotool can send a new event. Wow, shift-delete is so useful: how could you live without it on a mac? I just wish it didn't need to pause and could auto-repeat.)


  1. http://dennisideler.com/blog/custom-key-bindings-in-linux/
  2. http://tuxradar.com/content/xdotool-script-your-mouse
  3. man xbindkeys
  4. man xdotool


  1. sudo apt-get install xbindkeys
  2. sudo apt-get install xdotool
  3. (optional and not necessary) xbindkeys --defaults > ~/.xbindkeysrc && less ~/.xbindkeysrc to familiarize yourself with the xbindkeys notation. q to quit out of less. But this file contains a ctrl-f binding which inhibits regular searching, so I would remove it with rm ~/.xbindkeysrc before proceeding: or, at least, comment out the ctrl-f binding.

  4. create ~/.xbindkeysrc to contain the six lines:

    "sleep .04 && xdotool click 3"
      Mod4 + b:1
    "sleep .04 && xdotool click 2"
      Mod4 + shift + b:1
    "sleep .07 && xdotool key --clearmodifiers Delete"
      shift + BackSpace
    • You may test this configuration file by running xbindkeys -v in the terminal.
    • And now try pressing the apple-click combo to activate right-click.
    • Next, try pressing the apple-shift-click to copy and paste linux style: First select some text, then apple-shift-click (known as middle-click or wheel-click) into a text area.
    • last, try shift-delete to delete text ahead of the cursor.
    • cntl-c (within the terminal window) will stop testing.
  5. Finally, run xbindkeys and you are done. xbindkeys will automatically be run with the command /usr/bin/xbindkeys -f $HOME/.xbindkeysrc when lightdm starts. Not sure yet where this is executed from. You might just put a copy of or symlink to your .xbindkeysrc in every user's directory who intends to log in with the mac os keyboard. Note: I had originally posted that you must edit .xprofile to include xbindkeys : but that is not necessary.

Good Luck. -JJ

  • I don't understand, what is this supposed to do? It doesn't seem to have any effect on 12.04. I'd like the right command key to trigger the context menu. Why are you telling me to test by clicking the ctrl+mouse?
    – Cerin
    Jan 1, 2014 at 1:30
  • Cerin- I am using 13.10 so I cannot assure you this solution will work on 12.04: I was telling you to ctrl-mouse click (now option-mouse click) as a method for testing your work - at that point the secondary mouse click functionality should be working. If you would prefer to just use a different key (ie control only), use xbindkeys --key to help figure out what the key combo should be.
    – JJ Stiff
    Jan 1, 2014 at 2:04
  • Cerin- reading the edit on your post: did you make sure to 'sudo apt-get install xdotool' ? You should also be able to run 'xdotool click 3' from the terminal and have it pop up the context menu right where the mouse is located. Also: not sure why you are choosing 'm:0x50 + c:134' as your key combo: look at the examples which are provided when you 'xbindkeys --defaults > ~/.xbindkeysrc' (IE: do 'less ~/.xbindkeysrc' in the terminal)
    – JJ Stiff
    Jan 1, 2014 at 2:29
  • 3
    If you add "+ Release" to the binding, it triggers when you release the mouse button and you don't need the 'sleep' call. For example, to emulate OSX's control-click behavior, set the command to just "xdotool click 3" with trigger "Control + b:1 + Release".
    – rightparen
    Feb 20, 2017 at 16:54
  • To get the right-click emulation to work properly, I had to add "+ Release" per rightparen's comment, and also run xdotool with the clearmodifiers option, i.e. "xdotool click --clearmodifiers 3". I did not need the sleep command with this method.
    – Carlton
    Feb 14 at 17:07

Try holding the Option key (Alt key in Windows), which is next to the Ctrl key.

  • What do you mean by "Try the Option Key"? If you mean press that key, yes, I've tried all the keys, and none appear to be configured to trigger the context menu by default. Is there a way to configure this in Ubuntu?
    – Cerin
    Dec 4, 2010 at 17:27
  • I think he meant try left-clicking while holding down the ALT...
    – funk-shun
    Apr 7, 2011 at 20:31
  • That doesn't work for me on Ubuntu 12.04.
    – Cerin
    Mar 1, 2013 at 15:40

You must log in to answer this question.

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