2

I would like to change touchpad behaviour in Loki so that two-finger and three-finger taps would be swapped. Two-finger tap - middle mouse click, Three-finger tap - right mouse click.

Also physical button right click works in the same way as physical button left click. I would like physical button right click to work like mouse right click.

How to change those things in elementary?

11
  • I'm not aware of a gui for these settings, but it can be done with a conf file. Loki uses libinput. I'm more familiar with synaptics, but there is a tip on how to do this exact thing with libinput on the arch wiki. wiki.archlinux.org/index.php/Libinput#Button_re-mapping Commented Nov 19, 2016 at 18:48
  • I tried doing it but it didn't help. Added 'Option "Tapping" "on" Option "TappingButtonMap" "lmr"' to "libinput touchpad catchall" section in /usr/share/X11/xorg.conf.d/90-libinput.conf but nothing changed. Am I doing something wrong?
    – jukooz
    Commented Nov 19, 2016 at 19:51
  • I'm assuming you rebooted. Are there any other conf files. The lower the number the higher the priority. 50-***.conf will load first and 90-libinput will load later. If there is some conf file with trackpad setting before 90-libinput that could interfere. I can't test this on my loki machine because I use synaptics instead of libinput, but It sounds like you did it correctly. Commented Nov 19, 2016 at 21:07
  • Yes, I rebooted. There is 11-evdev-trackpad.conf, 50-synaptics.conf, 51-synaptics-quirks and few others that seem not related. How do you check if system uses libinput or synaptics in such a case?
    – jukooz
    Commented Nov 19, 2016 at 23:43
  • "cat /var/log/Xorg.0.log | grep synaptics" will show synaptics loaded and in use for touchpad if you are using synaptics, but unless you've set up synaptics you should be on libinput. 11-evdev-trackpad.conf could be interfering. Try putting the changes in it, if it has a trackpad section already. Commented Nov 20, 2016 at 7:39

1 Answer 1

4

I don't know how to get this to work with libinput, but here is how to install synaptics and set it up how you want. The process is fairly easy. Just install synaptics and set up a conf file. If you want to have multitouch gestures then you have to build synaptics instead of installing the package. You will also have to set up a second conf file. It is a little more work but handy. I use it for four finger swipes to change workspaces, three finger swipes to go forward and back in a bowser and three fingers up and down to open terminal and to minimize the current applications. You can set the gestures to do any keyboard command.

Optional (Do this if you want multitouch gestures)

  1. Install a build environment and dependencies for synaptics. In a terminal run:

    sudo apt-get install build-essential libevdev-dev autoconf automake libmtdev-dev xorg-dev xutils-dev liberal git libx11-guitest-perl

You now have all the tools to build from source and, hopefully, all the dependencies to build synaptics. If I forgot a package that synaptics needs it will throw up an error during the build process. You'll have to install the missing packages and start the build again, but I think this is all you will need.

  1. Grab the source code. In the terminal run:

cd

 git clone https://github.com/dieghen89/xserver-xorg-input-synaptics
 xserver-xorg-input-synaptics

Synaptics has dropped -m in recent builds. This is a forked version that keeps that function and is needed for multitouch gestures. Building the forked version didn't take long on my laptop, but did require editing three files. Go to the folder downloaded by the git command. Look in the src folder. You are looking for three files: These files are all located in the src directory and are named as follows:

  1. eventcomm.h
  2. ps2comm.h
  3. synproto.h

You need to add #include <xorg-server.h> to these three files. Just copy and paste it in right above the other #includes.

  1. build and install synaptics from the terminal

    cd xserver-xorg-input-synaptics ./autogen.sh ./configure --exec_prefix=/usr make sudo apt-get remove xserver-xorg-input-synaptics xserver-xorg-input-libinput sudo make install

removing xserver-xorg-input-synaptics is probably unnecessary since it is not installed by default, but if it is installed, you want to remove it before installing this build of synaptics. At this point you can reboot and the trackpad will work via synaptics with default settings.

  1. Setting up synaptics.

If you don't want multitouch gestures you can skip the above and just install the regular version of synaptics

sudo apt-get install xserver-xorg-input-synaptics

Once synaptics is install it is time to edit the conf file. The .conf files are in /usr/share/X11/xorg.conf.d I don't like to alter them too much. I leave them pretty much as is, just comment out what I don't want. This makes it easy to revert back to the original configurations if I ever need to. I opened 50-synaptics.conf and commented out all the trackpad section by putting a # in front of each line. I created a separate 50-synaptics.conf file in /etc/X11/xorg.conf.d This is just a personal preference. You could back up 50-synaptics.conf with the following command and then edit the 50-synaptics.conf file instead of creating a new one.

sudo cp /usr/share/X11/xorg.conf.d/50-synaptics.conf /usr/share/X11/xorg.conf.d/50-synaptics.conf.bk 

Here is the touchpad section from my 50-synaptics.conf

Section "InputClass"
        Identifier "evdev touchpad catchall"
        Driver "synaptics"
        MatchDevicePath "/dev/input/event*"
        MatchIsTouchpad "on"
                Option "Protocol" "event"
                Option "SHMConfig" "on"
                Option "TapButton3" "3"
                Option "TapButton2" "2"

EndSection

You can change switch TapButton3" "3" to TapButton3" "2" and set Tapbutton2 to "3". set that however you want then reboot and two finger tap and three finger tap will work. I have mine set for two finger = right click and three finger = middle click.

For more synaptics' options see here

  1. Set up multitouch gestures.

Download the xSwipe script.

cd && wget https://github.com/iberianpig/xSwipe/archive/e39800f21c1c33f38c3794d367d657f355296356.zip && unzip e39800f21c1c33f38c3794d367d657f355296356.zip && mv xSwipe-e39800f21c1c33f38c3794d367d657f355296356 xSwipe && rm e39800f21c1c33f38c3794d367d657f355296356.zip

This command downloads the script, extracts it, moves it to a folder called xSwipe and deletes the downloaded zip file. To configure it you will need to edit the eventKey.cfg file. There are two of these. One is in the main folder and one is in the nScroll folder. If you want to use Apple style Natural Scrolling then edit the one in nScroll, otherwise edit the one in the main folder. You will notice there is a section in the cfg for gnome, unity and pantheon. Pantheon is the DE for elementary, but editing this section doesn't work on Loki. It did work on Freya, but for Loki you need to edit the "other" section. Here is what mine looks like.

'other'=>{
    swipe2 =>{
        press   =>  "default",
    },
    swipe3 =>{
        right   =>  "LAL/LEF",       # alt +  left
        left    =>  "LAL/RIG",       # alt +  right 
        down    =>  "LSK/h",         # super + h
        up      =>  "F12",         # F12
        press   =>  "F12",        # F12
    },
    swipe4=>{
        right   =>  "LSK/LEF",       # super +  left
        left    =>  "LSK/RIG",       # super +  right    
        down    =>  "LAL/TAB",   # alt +  tab 
        up      =>  "LSH/LAL/TAB",    # shift + alt +  tab        
        press   =>  "LAL/F8",        # alt + F8
    },
    swipe5=>{
        right   =>  "LAL/LEF",       # alt +  left 
        left    =>  "LAL/RIG",       # alt +  right 
        down    =>  "LCT/LAL/UP",    # ctrl + alt + up 
        up      =>  "LCT/LAL/DOW",   # ctrl + alt + down
        press   =>  "LAL/F7",        # alt + F7
    },
    edgeSwipe2=>{
        right    =>  "LAL/TAB",       # ctrl + tab 
        left     =>  "LSH/LAL/TAB",   # shift + ctrl + tab 
    },            
    edgeSwipe3=>{
        down    =>  "LAL/F4",        # alt + F4 
        up      =>  "LCT/LAL/t",     # ctrl + alt + t 
    },
    edgeSwipe4=>{
        down    =>  "LAL/F4",        # alt + F4 
        up      =>  "LCT/LAL/t",     # ctrl + alt + t 
    }
}

You can set a gesture to do any keyboard command see here for how the script names keyboard keys. To run xSwipe run this command.

perl ~/xSwipe/xSwipe.pl 

Add -n if you want natural scrolling. Add -e if you want edge scrolling. I've set this up on a half dozen Loki machines without much trouble, but on a couple launching xSwipe made 3 finger tapping not work. I was able to fix this by creating a simple launch script for xSwipe. Go to the xSwipe folder in files. Right click and go to make new file. Name it xSwipe.sh and paste in:

#!/bin/sh
perl /home/username/xSwipe/xSwipe.pl &
sleep 10s
synclient TapButton3=3 &
synclient TapButton2=2 &

Change username to your username, add -n/-e and adjust the tapbuttons to your liking. This will launch xSwipe, wait a few seconds then reapply the tapbutton settings. To make the script executable run:

chmod +x ~/xSwipe/xSwipe.sh

Then run it with

./home/username/xSwipe/xSwipe.sh

Muiltitouch gestures only work when xSwipe is running in the background, but it must be set to run on every boot.

You can do this by navigating to System Settings>Applications>Startup then click the plus button in the lower left corner. In the bottom of the dialogue that launches you will see an option to enter a custom command, enter perl ~/xSwipe/xSwipe.pl.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.