- Touchpad Gestures in Linux Mint and Ubuntu
- Scope
- Configuration
- 1. Section: Touchpad ignore duplicates
- 2. Section: Touchpad catchall
- 3. Section: Default clickpad buttons
- Closing the active window
- 4. Section: Multi-finger taps
- Ultimate usage
- The ultimate tip
- Summary of touchpad actions
- In case of basic problems
- Linux mint touchpad gestures
Touchpad Gestures in Linux Mint and Ubuntu
But, there were far too many issues with that. Specifically, that I needed to set things in .xprofile, and for me, the gestures would become functional only if I had Suspended the desktop once after booting, and reran the script to disable 2 finger and 3 fingers in synclient, and then ran touchegg, which is basically a horrible experience.
There’s a better way, by switching to libinput from synaptics, which is a newer driver with input multitouch detection for touchpads.
sudo apt-get remove --purge xserver-xorg-input-synaptics sudo apt-get install xserver-xorg-input-libinput sudo gpasswd -a $USER input
Ideally at this point, your default synaptics drivers have been removed, and the libinput drivers will take over.
You can check that by running
xinput list xinput list-props \
Once you’ve confirmed you’re running libinput, run the following commands :
sudo apt-get install xdotool wmctrl sudo apt-get install libinput-tools
git clone http://github.com/bulletmark/libinput-gestures cd libinput-gestures sudo ./libinput-gestures-setup install
The default gestures are in /etc/libinput-gestures.conf. If you want to create your own custom gestures then copy that file to ~/.config/libinput-gestures.conf and edit it.
Here are the gestures from the file I use, to get you running quicker.
gesture swipe left 3 _internal ws_up gesture swipe right 3 _internal ws_down gesture swipe left 2 xdotool key alt+Right gesture swipe right 2 xdotool key alt+Left gesture swipe up 3 xdotool key shift+alt+Down gesture swipe down 3 xdotool key super+d gesture swipe up 4 xdotool key shift+alt+Up gesture swipe down 4 xdotool key alt+F4
Scope
Although equipped with a very capable driver by now, the standard installation brought up the touchpad of my Asus UX-32A Zenbook in a state in which it was indeed usable from the first moment on, but without any of its more advanced features. Thus the right button click and one-finger scrolling worked, but there wasn’t any multi-finger gesture. As far as I know, these features work only for newer models of Synaptics or Elantech, which was the case of the touchpad of my notebook. The vendor of an already working touchpad is revealed by a quick command:
As there is definitely more to it in Linux, although at the cost of some manual configuration, here is a detailed description about how to come up to the perfection of a MacBook’s touchpad under Mac OS X. This comparison suggests it already: we’re dealing here first and foremost with newer clickpads, i.e. with touchpads that like Apple’s one do not have any physical buttons. However, beside the soft buttons the following applies also to other types of touchpads, provided that they’re serviced by the synaptics driver. Chances are that this is the one you are using if your notebook has a touchpad, but the version of the driver is important (it should be at least v1.6.x), so let’s check it out:
…$ apt-show-versions | grep input-synaptics
And don’t forget, this tutorial is not for mouse lovers , unless they’re willing to get convinced…
Configuration
First of all, mark the following functions in the Touchpad section of the “Mouse and Touchpad” settings:
- Enable touchpad
- Tap to click
- Disable touchpad while typing
- Two-finger scrolling
- Enable horizontal scrolling
The secrets of the driver’s extended abilities are hidden in the file /usr/share/X11/xorg.conf.d/50-synaptics.conf which we must only adapt to our needs. While one can elucidate the options therein with a simple command man 4 synaptics, we’ll also need the synclient command (which is part of the driver package) to measure the dimensions of the soft buttons of the clickpad later on.
It is easier to start out with a working example, so enter in a terminal:
…$ test -d /etc/X11/xorg.conf.d || sudo mkdir /etc/X11/xorg.conf.d …$ sudo gedit /etc/X11/xorg.conf.d/50-synaptics.conf
If the file isn’t empty, somebody has made it up already and you’ll merely have to add the options which you’re interested in, otherwise just paste in the following contents as a whole:
# /etc/X11/xorg.conf.d/50-synaptics.conf (MagicMint) M0427 # Additional options may be added in the form of # Option "OptionName" "value" # See man synaptics (4) for details Section "InputClass" Identifier "touchpad ignore duplicates" # Ignore events from old driver MatchIsTouchpad "on" MatchOS "Linux" MatchDevicePath "/dev/input/mouse*" Option "Ignore" "on" EndSection Section "InputClass" Identifier "touchpad catchall" # Device Driver "synaptics" MatchIsTouchpad "on" MatchDevicePath "/dev/input/event*" # Palm detection Option "PalmDetect" "on" Option "PalmMinWidth" "4" Option "PalmMinZ" "1" # Dragging & tapping Option "LockedDrags" "on" Option "FastTaps" "on" Option "AccelFactor" "0.1028806" #2x Option "MinSpeed" "1" Option "MaxSpeed" "1.75" EndSection Section "InputClass" Identifier "Default clickpad buttons" # Lacking mouse buttons MatchDriver "synaptics" Option "LTCornerButton" "8" # Left-handed pad w/ middle button on the left side #Option "SoftButtonAreas" "1630 0 1737 0 0 1629 1737 0" # Right-handed pad w/ middle button on the right side Option "SoftButtonAreas" "0 1629 1737 0 1630 0 1737 0" EndSection Section "InputClass" Identifier "Multi-finger taps" MatchDriver "synaptics" # The following worked in Nadia only via synclient Option "TapButton1" "1" Option "TapButton2" "3" Option "TapButton3" "2" EndSection # End of configuration file
1. Section: Touchpad ignore duplicates
The duty of this section is to filter out touchpad events which would be potentially duplicated otherwise by a legacy driver, causing that way a race condition between both drivers which could prevent the touchpad from functioning properly.
2. Section: Touchpad catchall
This section is committed to the actual configuration of the touchpad. The options therein are self-explaining; in case of a doubt or extra wishes please refer to the manual page aforesaid. The acceleration factor is for instance the double of its original value — we’ll see in a moment how to measure that.
The point of this configuration file is, that for almost all settings of the touchpad, this is the only place where they will be remembered across sessions: most graphical utilities in GNOME, for example, do not guarantee this and in addition they’re incomplete at most.
3. Section: Default clickpad buttons
As we all know, PC mouses use to have more than just one button. Hence, even a clickpad like mine that has none pretends to have three of them:
1. left mouse button | |
2. right mouse button | 3. middle mouse button |
Assigning the right mouse button to the left of the clickpad is the right-handed variant in the file above, since this is the only way to use mouse gestures bound to the right button (in Opera, Firefox, etc.) with the thumb of the right hand.
Anyway, as touchpads differ in size, it is advisable to enter the exact coordinates of the four corners of such a soft button mimicked by the clickpad. In order to do so, with the brand new configuration file in effect, log out from your graphic session and log in anew. With the command
…$ xinput test ID_number_from_the_very_first_command
typed in a terminal, you can now easily find out these coordinates which you must then write down, of course. At this point you can also experiment with the speed settings of the pointer by listing and setting them via synclient:
…$ synclient -l …$ synclient AccelFactor=0.12345678
Closing the active window
The top left corner of the touchpad is assigned to a fictitious mouse button number 8 which will be used to close the active window on the screen. The choice of the top left corner follows from a right-handed view again, since it is out of any accidental reach of the right hand. (To be consistent with this, I’ve also re-arranged the window buttons in cinnamon — I’m a bit of nostalgic about Mac OS’ differences to Windows . You can achieve this by setting the leftmost title bar button in cinnamon’s windows settings to «close».
This is a kind of automation task, so we need, well, the package xautomation. Furthermore, we should also install xbindkeys to realize the closing of a window with an emulated mouse button:
…$ sudo apt-get install xautomation xbindkeys
The linking between the two is done automagically by the file:
Its contents should be the following:
# ~/.xbindkeysr (MagicMint) H0129 # Bind the 8th mouse button to close the current window "xte 'keydown Alt_L' 'key F4' 'keyup Alt_L'" b:8 # End of xbindkeys configuration
4. Section: Multi-finger taps
This section is appointed in theory to instantiating the multi-finger tap support of the driver in a way such that the number of fingers used to tap be the same as the figures in the illustration above, making thus the tap behave in the same manner as the corresponding soft button.
Ultimate usage
For the time being, the synaptics driver cannot recognize more complex gestures such as pinching, rotating, etc. But nevertheless you can add them to the repertoire of your touchpad by means of ginn, a utility meant to incorporate legacy applications into Unity’s gesture schema in Ubuntu (if you have trouble getting it to work, try touchegg instead):
In our installation we use it to provide 4 finger gestures (anything below this number of fingers is seized by synaptics). With that many fingers the “pinch” gesture didn’t work for me, so the following makes only usage of rotate, tap and drag to perform 7 standard actions on the active window (summarized at the end of this tutorial). Please verify in your keyboard’s shortcuts settings if the keys given match the desired actions, for example Shift + Super (Windows) + Down to minimize a window, and don’t forget to enable window tiling and snapping in cinnamon’s corresponding settings:
You should replace the contents of the sample configuration file:
…$ sudo gedit /etc/ginn/wishes.xml
by the following contents and install ginn as an autostart program (under Menu› Preferences› Startup Applications), thereby activating it after the next log in:
plus minus Down Down Up Right Left
The ultimate tip
Besides having a highly configurable driver, modern clickpads offer another advantage too (although this is often seen as a serious disadvantage by many — otherwise there would be no extra key to switch them off ): a relatively big surface.
If you’re drawing sketches or editing photographs a lot, you can as well use a stylus for touchscreen devices like the iPad — this could definitively replace your mouse, as it does for me.
Summary of touchpad actions
Action | Fingers | |||
1 | 2 | 3 | 4 | |
press | left click: action | right click: context menu, begin browser gesture | middle click: paste | — |
tap | right click: context menu | minimize window | ||
top left corner tap | close window | — | — | — |
drag up | move | browser gestures (press only) | — | push tile up |
drag down | — | push tile down | ||
drag right | — | push tile right | ||
drag left | — | push tile left | ||
rotate right | — | — | — | increase zoom level |
rotate left | — | — | — | decrease zoom level |
In case of basic problems
For troubleshooting, please refer to this resource on the Archlinux wiki.
Linux mint touchpad gestures
Operating System : Linux Mint 17 (qiana)
Kernel Linux 3.13.0-24-generic
Hardware : Intel Core i5 CPU 2.230GHz
For this you will need to install “touchegg” and “compiz”. These two can be downloaded with the
“Synaptic package manager” or from the “Terminal” . In order for compiz to fit in properly, you’ll need to install
[ If running Mint 17.1 (Rebecca), there’s no need to install Compiz nor dconf (dconf is interesting in itself
though). You only have to set compiz as the window manager, to do so, open Mate Menu > Control Center >
Desktop Setting > Windows . Set Compiz
Synaptic, in Mate , can be found in the Mate menu > Administration > Synaptic package manager.
From the Terminal, use the following commands.
$ sudo apt-get install touchegg
$ sudo apt-get install compiz —install-recommends
$ sudo apt-get install dconf
OK, you can now proceed to editing the settings.
Let’s start with compiz, you can open compiz settings from the Mate menu > Preference > CompizConfig Settings Manager.
You’ll first want to configure the “launch pad” keyboard shortcut to “expo” (assuming you use or have multiple desktops).
Expo is located in Category > desktop > expo in the Compiz Settings .
From there, pick expokey, a pop up window show’s up, click on “grab key combination” then press the “launch pad” key. It should give you something like “XF86LaunchA” ‘or’ “XF86LaunchB” (or not).
Now for the “Scale” key, do the same. The Scale configuration are in Category > Window Management > Scale > Bindings.
pop up window show’s up, click on “grab key combination”
That was for Compiz, now for Touchegg.
Proceed by editing the .conf file of touchegg.
/home/username/.config/touchegg/touchegg.conf
This can be done with the terminal using:
# sudo nano /home/username/.config/touchegg/touchegg.conf