6

My friend has a Dell Netbook with a twitchy touchpad and doesn't really right click reliably (the pointer moves as you right click).

He would like to be able to do something like use a modifier key and normal left click and have that register as a right click in the UI. Unfortunately this netbook does not have the typical right menu shortcut key on the keyboard.

He is pretty sure this is not possible in standard GNOME, but how about Unity? Is this possible?

Jorge Castro
  • 71,754

2 Answers2

7

Install xdotool and xbindkeys:

sudo apt-get install xdotool xbindkeys

Create a binding in $HOME/.xbindkeysrc for e.g. Alt+:

"xdotool click --clearmodifiers 3"
  alt + b:1

And then start xbindkeys (typically, this would go into your xinit file so that it is started everytime you log in.)

Now the problem here is that although it should work with the --clearmodifiers option, something (Unity? Compiz? The global menu?) is preventing the alt key from getting released. An ugly workaround (until someone gives you a better answer) would be to add a sleep 1 and release the alt key yourself:

"sleep 1; xdotool click --clearmodifiers 3"
   alt + b:1

So: if you press Alt and click the left mousebutton, then release Alt within 1 second, you will get a right mouseclick (although with 1 second waiting time).

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
xubuntix
  • 5,580
1

You could also go to settings -> accessibility -> simulated second click.

This allows you, by holding the left click for long enough, to provoke the right click.

I was looking for a faster approach than this answer, however it is still at least a 1 second wait, even on the shortest interval setting.

  • Commentswer by @DavidFrias:

    You can solve this 1 second waiting time:

    "xdotool click --clearmodifiers 3" control + alt + b:1 + release

    Like this, menu is showed immediately when you release keys and button. As you can see I use control+alt, but I guess it can work only with one key as well.

    – Elder Geek Aug 06 '17 at 20:43