70

In almost all the large modern Linux distributions and in the last releases of Ubuntu-based distributions the touchpad was configured out of the box to have right, left and middle clicks and you could configure them easily. The middle click is usually done with a two or three-finger tap.

In Ubuntu 12.04 I haven't seen where to enable the middle click and it is not enabled by default.

1
  • Answer will depend somewhat on the type of trackpad you have, but generally it's just a matter of adding the appropriate option to /etc/X11/xorg.conf. Some instructions for Synaptics trackpads: askubuntu.com/a/126539/43660 May 6, 2012 at 10:32

16 Answers 16

45

You can make it work and persist in Ubuntu 12.04, even afer suspending, following these steps.

First, create a file with your script:

echo synclient TapButton3=2 > ~/touchpad_settings.sh

(You could place the script in another directory, e.g. /usr/bin or /etc, if you wanted it to be in a more "generic" place, in case you have multiple accounts in your ubuntu installation.)

Then make it executable:

chmod +x ~/touchpad_settings.sh

And finally, run the following command replacing "user" with your user name:

gsettings set org.gnome.settings-daemon.peripherals.input-devices hotplug-command "/home/user/touchpad_settings.sh"

Then reboot, or logout & login, or restart GNOME.

That's all!

For more information about this fix, go here.

2
  • 1
    See also Manuker's answer for middle click (in addition to tap)
    – z0r
    Jun 7, 2015 at 7:04
  • Any idea how to make this working system-wide, i.e. for all users on a system? Dec 29, 2017 at 9:22
39

I was searching for this and I found out that the touchpad has different settings for taps at the corners, and if you tap at the bottom right corner it does Right click. But if you tap at the top right corner it does Middle click. This is the default setting.

8
  • 4
    Yeah, I found accidentally one tap on the top right corner on my multitouch touchpad acts like a middle click. Right click is two-finger tap for me. May 25, 2013 at 11:08
  • 5
    This appears to still be the default in Ubuntu 14.04. I can't believe that htere doesn't seem to be any documentation or even a GUI representation of this in the Mouse & Touchpad settings dialog. Oct 1, 2014 at 8:11
  • Is there any way to disable this? Apr 1, 2015 at 15:42
  • 2
    It's 2015 and this still works :) Apr 24, 2015 at 1:06
  • 1
    For me, in Ubuntu 20.04.2 LTS, the middle tap is in the bottom-middle area of the trackpad. This answer led me to find it : )
    – Sofía
    Jul 28, 2021 at 14:44
20

Another option which might be simpler and avoids startup scripts is the following.

  1. Stop the gnome settings daemon from overriding existing settings (font: Touchpad Synaptics - ArchWiki).

    gsettings set org.gnome.settings-daemon.plugins.mouse active false
    
  2. Edit the X11 configuration file for the touchpad.

    sudo -H gedit /usr/share/X11/xorg.conf.d/50-synaptics.conf
    

    and add your button options under the section with the synaptics driver, like so:

    Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
            Option "TapButton1" "1"
            Option "TapButton2" "3"
            Option "TapButton3" "2"
            Option "HorizTwoFingerScroll" "on"
            Option "VertTwoFingerScroll" "on"
    EndSection
    
6
  • 8
    As of 13.10, /usr/share/X11/xorg.conf.d/50-synaptics.conf warns "DO NOT EDIT THIS FILE, your distribution will likely overwrite it when updating. Copy (and rename) this file into /etc/X11/xorg.conf.d first." Oct 24, 2013 at 15:57
  • Can you help me how to Simulate a middle-click on Lenovo Yoga 2 Pro Synaptics touchpad too?
    – rubo77
    Jun 20, 2014 at 10:11
  • 1
    @Firefeather: Maybe you want your distribution to update it, because it could be, that your distribution finds an even better solution than this. I would just keep in mind to add this again in case the distribution overwrites it
    – rubo77
    Aug 30, 2014 at 23:05
  • @rubo77 the point is that if your distro provides a better solution, then you copy the relevant improvements into the user version in /etc! rather than risk getting your customisations in /usr/share - a directory that should almost always be treated as though it were read-only - trashed, if you don't "keep in mind" all the things you risk losing by not using etc ;-) Feb 29, 2016 at 20:33
  • I am using Xubuntu 18.04. Worked. I didn't need to do step 1, and in Step two the path was /usr/share/X11/xorg.conf.d/70-synaptics.conf
    – ruediste
    Mar 14, 2019 at 15:49
18
synclient ClickFinger3=2
synclient TapButton3=2

To show the list of actual values:

synclient -l

hope it helps (it did for me!)

5
  • ClickFinger3=2 is great - now it works like in Debian.
    – z0r
    Jun 7, 2015 at 6:59
  • how it works? I set those values, but is not clear how can I tap or click the middle button
    – sites
    Jul 18, 2015 at 17:18
  • An exhaustive description of all the settings can be found in the synaptics man page. In this case, the above settings enable middle-clicking by tapping or clicking with three fingers.
    – Jim Hurne
    Nov 13, 2015 at 11:31
  • also works in ubuntu17.04 after the triple-click disappeared during dist upgrade
    – wotanii
    May 4, 2017 at 11:06
  • This worked for me but restarting the system reverts the change done using this command. How can I preserve it?
    – Bej
    May 17, 2019 at 5:26
6

Download synaptiks from the Software Center.

Open it, then go to Touchpad Configuration >> Tapping.

Set your configuration there, as you would like.

3
6

You can enable it with the command synclient TapButton3=2 in the terminal, but that seems to get overridden on suspend+resume and after a reboot.

Permanent solution:

It's explained for Xfce in this Xfce forum thread

However, unity-2d (and I suppose also Unity) likes to fiddle with these settings on resume, and I have no idea how to disable that. maybe it's utouch, I don't really know.

The bottom line is that there is a way to configuring middle click permanently:

  • add a custom startup application (under the 'gear' menu in unity on the top right) with any name you like, e.g. "touchpad tweak" and the command sh -c "/usr/bin/synclient TapButton3=2", then save it.

This is well and good until you suspend and resume. for that:

  • Open a terminal, and type gksudo gedit /etc/pm/sleep.d/80-synaptics-three-finger
  • Copy and paste the following text into the file:

    #!/bin/sh
    
    # Restore three finger tapping
    
    case "$1" in
            resume|thaw)
                    sleep 5;
                    /bin/su YOUR_USER_NAME -c "/usr/bin/synclient TapButton3=2"
                    ;;
    esac
    
  • Replace YOUR_USER_NAME with your login name - not the long one; e.g. use 'fred' instead of 'fred fuchs'. if you don't remember it, you can always type whoami in a terminal window and it'll tell you.

  • Save the file.

  • Make it executable; simply type sudo chmod +x /etc/pm/sleep.d/80-synaptics-three-finger in the terminal window. it will ask for your password.

If you did all this correctly, your system should retain three finger clicking as middle click after a suspend/resume cycle.

Now that was fun and user-friendly, wasn't it? I can only wonder why unity silently meddles with synclient settings and wonder even more why there isn't a simple GUI tool to configure all of this. anyway, there you have it.

4
  • Why did this get a downvote?
    – kzh
    Jul 15, 2012 at 20:01
  • The suspend/resume task is something i've been needing to do for a while. Thanks!
    – tucuxi
    Sep 14, 2012 at 11:10
  • @kzh: maybe because of my sarcastic tone. or could be because it's better to put it in the xorg.conf (at the end if there's already one) like so: Section "Inputclass" Identifier "touchpad catchall" Driver "synaptics" MatchIsTouchpad "on" Option "TapButton3" "2" EndSection
    – bamdad
    Sep 16, 2012 at 22:19
  • sorry, the comment form ate my line breaks. you get the point, hopefully. :) in case not, i'll edit my original answer.
    – bamdad
    Sep 16, 2012 at 22:26
4

I tried several solutions offered here, but nothing was working on my Toshiba Satellite. The trick seems to be the distinction between a "touchpad" which is a mouse pad with buttons adjacent to it, and a "clickpad" which is a pad with no adjacent buttons: you click the pad.

This Toshiba Satellite has a clickpad, so clicking in the corner didn't work, and I couldn't get three-finger click to work.

Based on dllud's answer, I found I had to edit (on kubuntu) /usr/share/X11/xorg.conf.d/50-synaptics.conf based on information at https://wiki.archlinux.org/index.php/Touchpad_Synaptics#Buttonless_touchpads_.28aka_ClickPads.29 and I now have sections like so:

Section "InputClass"
    Identifier "Default clickpad buttons"
    MatchDriver "synaptics"
    Option     "SoftButtonAreas"  "60% 0 82% 0 40% 59% 82% 0"
EndSection

This sets the pad to be 40% left button, 20% middle button, 40% right button. It still takes some practice to hit the middle correctly.

1
  • You made my day. Thanks a lot. Hooray my ShitPad now has a middle button! Jun 15, 2021 at 20:41
4

Just updating for Ubuntu 20.04:

  1. Go to Ubuntu Software and install "Tweak advanced GNOME 3 settings";
  2. On "Tweaks" go to "Keyboards & Mouse";
  3. On "Mouse Click Emulation" select "Fingers" option;

That's it: two fingers for right-click and three fingers for middle-click!

3
  • 1
    Only an angel decides to just post on an 11 year old thread with the new and updated solution. This should be marked as the new answer.
    – Amjo
    Feb 16, 2023 at 9:16
  • @Amjo you've made my day ;-) Feb 17, 2023 at 12:36
  • 1
    gsettings set org.gnome.desktop.peripherals.touchpad middle-click-emulation true on Ubuntu 22 (i.e. Wayland) without any additional software. askubuntu.com/a/1417258
    – igor
    Apr 11, 2023 at 12:03
2

Touchpad with buttons

I used to have a laptop with touchpad buttons, and to click both of them simultaneously to cause middle click emulation.

Touchpad without button

I now have a buttonless touchpad. Here is what I did:

Use the following command to learn about your touchpad size values and configuration:

$ synclient -l | grep 'Area\|Edge\|ClickFinger' 
LeftEdge                = 129
RightEdge               = 3105
TopEdge                 = 126
BottomEdge              = 2211
VertEdgeScroll          = 0
HorizEdgeScroll         = 0
ClickFinger1            = 1
ClickFinger2            = 3
ClickFinger3            = 0
AreaLeftEdge            = 0
AreaRightEdge           = 0
AreaTopEdge             = 0
AreaBottomEdge          = 0
RightButtonAreaLeft     = 1617
RightButtonAreaRight    = 0
RightButtonAreaTop      = 1916
RightButtonAreaBottom   = 0
MiddleButtonAreaLeft    = 0
MiddleButtonAreaRight   = 0
MiddleButtonAreaTop     = 0
MiddleButtonAreaBottom  = 0

Then use synclient var1=value1 var2=value2 ... syntax to modify those values to suit your needs. See the example command I give belo

Note that:

  • ClickFinger1, ClickFinger2 and ClickFinger3 options remap clicks when they are done with respectively one, two or three fingers left touching the touchpad.
  • Value 1 corresponds to left click.
  • Value 2 corresponds to middle click.
  • Value 3 corresponds to right click.

Here is the command I ran and set in the Startup Applications Preferences window to configure my touchpad:

$ synclient RightButtonAreaTop=0 RightButtonAreaLeft=0   MiddleButtonAreaTop=1916 MiddleButtonAreaLeft=1617  ClickFinger1=0
  • RightButtonAreaTop=0 and RightButtonAreaLeft=0 unset the "right button" causing right click (I failed to use ivan-volosyuk's settings to have all three buttons set. I only have middle click). I use two-finger tap to produce right click. Not being able to maintain right click is not bothering enough to push me to find a solution.

  • MiddleButtonAreaTop=1916 and MiddleButtonAreaLeft=1617 set the "right button" to cause middle click.

  • ClickFinger1=0 Disables the special interpretation of the click which happen when one finger touches the surface at the moment of the click. Its previous value: ClickFinger1=1 caused my right clicks being interpreted as left click when leaving a non-clicking finger touching the touchpad.

Hack it the way you like. Maybe you'll do better than me.

1

Check this. http://forums.debian.net/viewtopic.php?p=354960#p354960 I have put on startup

xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Tap Action" 8 0 0 0 0 1 3 2
1
  • it doesn't have any effect with libinput, at least on kde Aug 16, 2017 at 9:02
1

Touchpad has different settings for taps at the corners, and if you tap at the bottom right corner it does Right click. But if you tap at the top right corner it does Middle click. This is the default setting.

simple bro works for me :)

1
  • 1
    How would one configure this? How do you it's the default setting on his computer?
    – Kaz Wolfe
    Oct 5, 2014 at 21:27
1

Clicking both left and right buttons at the same time works for some systems.

See the Xorg documentation and search for the term "middle".

Ubuntu 12.04
touchpad: Elantech

1

synclient seems not working with me, so I used this command

 xinput set-prop 15 "Synaptics Tap Action" 2, 3, 0, 0, 1, 3, 2

and add it to .bashrc file, so it will execute on startup. Last value 2 sets three-finger tap to execute middle-click.

0

If you look in the XFCE wiki for mouse/trackpad settings it will mention how "Device Properties" can be set. Unfortunately it's not complete because direct device settings have to be under Properties/ to take effect. For example, to make two finger touches middle click and three finger touches right click I need to alter "Synaptics Tap Action". Here's what it looks like initially:

$ xinput list-props "ETPS/2 Elantech Touchpad" | grep "Tap Action"
    Synaptics Tap Action (298): 2, 3, 0, 0, 1, 3, 0

To have XFCE 4.12 set this it is necessary to do the following:

xfconf-query -c pointers -p /ETPS2_Elantech_Touchpad/Properties/Synaptics_Tap_Action -n -t int -t int -t int -t int -t int -t int -t int -s 2 -s 3 -s 0 -s 0 -s 1 -s 2 -s 3

Now we can see it changed:

$ xinput list-props "ETPS/2 Elantech Touchpad" | grep "Tap Action"
    Synaptics Tap Action (298): 2, 3, 0, 0, 1, 2, 3
0

In Ubuntu 22.04.3, The middle click is in the bottom-middle area of the trackpad/touchpad/mousepad.

No need to download any third-party package.

-1

I would recommend adding synclient TapButton2=2 and synclient TapButton3=3 to your ~/.bashrc configuration. To do this open a terminal and run:

$ echo synclient TapButton2=2 >> ~/.bashrc
$ echo synclient TapButton3=3 >> ~/.bashrc

Then reboot your computer.

The synclient commands do the following:

  • synclient TapButton2=2 will set the two-finger tap to a middle button click.
  • synclient TapButton3=3 will set the three-finger tap to a right button click.
1
  • Instead of putting it in your bashrc, you can do the follow. Edit /usr/share/X11/xorg.conf.d/50-synaptics.conf. In the section for your device, add 'Option "TapButton3" "3"'.
    – Atif
    Jun 14, 2016 at 3:54

You must log in to answer this question.

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