Enable touchscreen right click on Linux

While Android is designed to be used with one hand, most Linux workflows are intended for a keyboard and mouse. While the onboard screen keyboard performs well in its role, the toucscreen is only a partial replacement for the mouse because it cannot contain multiple buttons.

Thus, the ability to perform a right click in Linux is crucial.

This tutorial will show you how to enable hold-to-right-click in Linux. It was developed using Ubuntu Mate 20.04 on the Raspberry Pi.

Before you start, you need to know whether your device is running armHF or arm64. The command below will give you this information on Ubuntu Mate 20.04 (which is the recommended Linux distribution for the Feasible.

dpkg --print-architecture

Installation instructions

Install the libevdev libraries and headers

sudo apt-get install libevdev*
Create a working directory. For the purpose of this tutorial, we will assume that your working directory is called /workingdir. Download libevdev-right-click-emulation from github. cd /workingdir; git clone https://github.com/PeterCxy/evdev-right-click-emulation.git
If you are running arm64 instead of armHF, you need to change the makefile. Download the arm64-compatible makefile and overwrite the existing Makefile with it. Note that you must save the newly downloaded file as Makefile

Compile the program

cd /workingdir/evdev-right-click-emulation; make all

Test evdev-rce. Try using long presses to execute right clicks after running the command below.

LONG_CLICK_INTERVAL=500 LONG_CLICK_FUZZ=50 /workingdir/evdev-right-click-emulation/out/evdev-rce&

If right click works, copy evdev-rce to /usr/local/bin

sudo cp /workingdir/evdev-right-click-emulation/out/evdev-rce /usr/local/bin; chmod 755 /usr/local/bin/evdev-rce

Add the evdev-rce command to the end of ~/.profile so that right click emulation is started automatically when you log in.

echo "" >> ~/.profile; echo 'LONG_CLICK_INTERVAL=500 LONG_CLICK_FUZZ=50 /usr/local/bin/evdev-rce&' >> ~/.profile