fingers on laptop touchpad

By default, Ubuntu uses a two-finger tap for right-click and a three-finger tap for middle-click on laptop touchpads. You can swap this behavior, but Ubuntu doesn’t provide a graphical utility for configuring it.

Swapping this behavior is simple and only involves running a command or two — however, making your changes persistent requires creating a script and telling GNOME to automatically run it when the system boots or resumes from suspend.

Image Credit: Michael Mol on Flickr

Swap Two Finger & Three Finger Taps

Launch a terminal and run the following command to swap the tap behavior:

synclient TapButton2=2 && synclient TapButton3=3

These synclient commands tell “TapButton2” (two-finger tap) to produce action 2 (middle-click) and “TapButton3” (three-finger tap) to produce action 3 (right-click).

After running these commands, your tap gestures will be reversed. However, this setting isn’t persistent across system restarts or suspend and wake cycles.

Making Your Configuration Persistent

To make this setting persistent, you’ll have to create a special script and tell GNOME to run it. You can’t just add the script to your startup applications or Ubuntu will overwrite the touchpad’s settings when your system from suspend.

To create the script, open a text editor such as Gedit, which you can launch from the Dash.

Add the commands used above to a new text file like so:

synclient TapButton2=2
synclient TapButton3=3

Save the file with the .sh file extension — for example, you could name it

After you’ve saved the file, launch a terminal and run the following command to make your new script executable, replacing /home/name/ with the path to your script:

chmod +x /home/name/

Next, run the following command — replacing /home/name/ with the path to your script — to tell GNOME to run your script whenever an input device is connected (for example, when your system boots or resumes from suspend). This makes your settings persisent:

gsettings set org.gnome.settings-daemon.peripherals.input-devices hotplug-command “/home/name/”

Profile Photo for Chris Hoffman Chris Hoffman
Chris Hoffman is Editor-in-Chief of How-To Geek. He's written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader's Digest, been interviewed as a technology expert on TV stations like Miami's NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read more than one billion times---and that's just here at How-To Geek.
Read Full Bio »