Capacitive screen long press simulates mouse right button function

Test system: 2022-04-04-raspios-bullseye-armhf 32-bit (64-bit systems are not supported yet)

Software Installation

wget https://github.com/PeterCxy/evdev-right-click-emulation.git

cd evdev-right-click-emulation

sudo apt install build-essential libevdev2 libevdev-dev

cd 'evdev-right-click-emulation'

sudo cp 'out/evdev-rce' '/usr/local/bin/'

sudo chmod +x '/usr/local/bin/evdev-rce'

Input the command

sudo evdev-rce 

After running, you can touch and hold to implement the right-click function.


Set the pi user to be able to execute

sudo usermod -G 'input' -a pi

echo 'uinput' | sudo tee -a /etc/modules

sudo nano  /etc/udev/rules.d/99-uinput.rules


Add the following content to the 99-uinput.rules file

KERNEL=="uinput", MODE="0660", GROUP="input"

Save and run in terminal

sudo udevadm control --reload-rules

sudo udevadm trigger

then restart

sudo reboot


Run after restarting (no need for sudo at this time)

evdev-rce 

After running, you can touch and hold to implement the right-click function.


Set up startup

Enter in the terminal

sudo mkdir ~/.config/autostart

sudo nano ~/.config/autostart/right_click.desktop


Add the following to right_click.desktop

[Desktop Entry]

Version=1.0

Type=Application

Name=evdev-rce

GenericName=Enable long-press-to-right-click gesture

Exec=env LONG_CLICK_INTERVAL=1000 LONG_CLICK_FUZZ=200  /usr/local/bin/evdev-rce

Terminal=true

StartupNotify=false


If you want to modify the sensitivity, you can modify "LONG_CLICK_INTERVAL=1000"

"LONG_CLICK_FUZZ=200" these two parameters

Sign In or Register to comment.