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)
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.
- 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:
- eventcomm.h
- ps2comm.h
- 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.
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.
- 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
- 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
.