The usability of Windows touchpad gestures has increased with the rollout of Windows 10, with not only a greater variety of gestures, but also an undeniable improvement in smoothness. In contrast, optimizing the touchpad experience for Linux, which is lacking on the desktop, is a concern for both Linux users and laptop users.
The following article focuses on Wayland’s own libinput and does not discuss alternatives such as synaptics. In addition, I have made some minor contributions to libinput’s Archwiki Chinese entry, which can be helpful too.
Editing touchpad-related Xorg configuration files
The configuration files for Linux input devices are stored in
30-touchpad.conf, as the name implies, the configuration information for the touchpad. Copy them to
/usr/share/X11/xorg.conf.d and modify it. At this point you can refer to the basic framework of
40-libinput.conf and follow the following configuration format
Option "Tapping" "on" turns on the “touch tap” operation of the touchpad which eliminating the need to press the touchpad.
Option "NaturalScrolling" "true" restores a more natural scrolling orientation, allowing you to gain experience on Windows.
Option "ClickMethod" "clickfinger" turns on the option of “two-finger click” for right-click and “three-finger click” for middle-click.
In addition, libinput provides more options for “tap”, “scroll”, “touchpad pointer acceleration”, etc. Other configuration options can be found in libinput’s man page
For more information about libinput’s various point-and-click scrolling operations, there are friendly illustrations in its documentation to help understand them. Also, you can see the configuration and support for other input devices such as “red dots” and “touch screens”, which are outside the scope of this article on “touch panels”, so they are not discussed.
The xdotool is a tool that can simulate keyboard and mouse input. When used in conjunction with the libinput-gestures package mentioned below, you can add and optimize touchpad gestures by binding them to corresponding hotkeys or mouse actions.
In the ArchWiki’s Recommended for Xorg’s emulation of keystrokes, xdotool is described as “Very Buggy”. However, after using it briefly, I think xdotool is very simple and bug-free (maybe I’m only using the part that handles keyboard input 😂) Here is the basic operation of xdotool
This can be considered a very clear syntax. It is worth noting that xdotool calls several special keys:
1 left mouse button,
2 middle mouse button,
3 right mouse button,
Left left array button,
Right right array button,
Super Windows logo key,
plus plus sign,
minus minus sign.
xdotool also supports window retrieval, getting window focus, etc., which can fulfill most of the keystroke automation needs.
Install libinput-gestures and add the current user to the input group, copy the configuration file template
~/.config/ for modification. Start
libinput-gestures-setup for initialization
where gestures are known by libinput-gestures as
pinch, which correspond to finger swipe and pinch operations on the touchpad, respectively. As we all know, the
- hotkeys can basically zoom in and out on most software views, and it is customary to open both fingers for zooming in and pinch them for zooming out, so add them to
pinch, you can specify
out and the number of fingers involved in the action. Similarly, for
swipe, the number of fingers involved and the four directions of swiping (
Down) can be specified, and here is an example of swiping left and right to switch tabs in Chrome.
Three finger swipe right goes to the next tab, three finger swipe left goes to the previous tab. There is no corresponding animation feedback, but it works fine.
From reading libinput-gestures related chapter, I learned that the touchpad does not differentiate between swipe and pinch with the same number of fingers involved in the action. pinch is not completely accurate, so do not configure the same number of fingers of two different actions coexist. The later experience will be poor for the greater the probability of misjudgment. Especially when the same number of fingers swipe but in different directions, such as configuring two fingers left and right swipe to switch applications, it is likely to conflict with two fingers up and down swipe, that is, scrolling action.
The following are examples of xvkbd implementing
left mouse click and
xte operations on key combinations are implemented using
keyup. Here is an example of xte’s implementation of
Similarly, you can also bind libinput-gestures to launch an application directly, such as a four-finger swipe up to call out the application shortcut portal.
When you encounter a jumping and flashing touchpad pointer, or a serious gesture miscalculation, try restarting libinput-gestures with the following command
Thanks for reading 💗