Fake Middle Mouse Button in Ubuntu Unity With a Touchpad

The Problem

It’s been years since I’ve used a laptop that actually had a middle mouse button, and it can be tricky getting the timing right to press the left and right touchpad buttons simultaneously to fake a middle button press. Happily, there’s a really simple way to turn a two-finger tap on the touchpad into a middle button click. This guide assumes that you are familiar with command line and scripting basics.

Make the Script

  1. Create the file touchpad_settings.sh, with these contents, then chmod +x it to make it executable.
    synclient TapButton2=2

Tell Unity to Run the Script

  1. Run the Startup Applications program in Unity.
  2. Click Add
  3. For Name, type “mouse fix”
  4. For Command, provide the full pathname of touchpad_settings.sh
  5. For Comment, type “touchpad two-finger tap as middle mouse button” in case you forget why you put this here in the first place.
  6. Click Add.
  7. Click Close.

Run it

  1. The script will execute each time you log in, but to save yourself a logout/login cycle, you can just run it directly in your shell.


  1. Touchpad Configuration
  2. Running Programs on Login


Leave a Reply

Your email address will not be published.