JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

[How To] Two finger touch for right click

Fri Mar 04, 2016 1:43 am

Credit goes to @gadgetoid for finding the method, testing it, and confirming that it works in this thread. viewtopic.php?f=108&t=121602&start=25 I'm just adding some polish.

Since "right click" is a popular feature that was lost with the upgrade to Jessie I thought I'd post this with an appropriate title, to make it easier to find, and step by step instructions that anyone can follow. Hopefully it will be a help for those wanting a "right click" function again.

uname -a reports: Linux rpi4 4.1.18+ #846 Thu Feb 25 14:11:56 GMT 2016 armv6l GNU/Linux so that's what I'm using.

First we'll need to fetch the files, I created a temp directory to work in, and afterward it can be deleted. So open a terminal and get started.

Code: Select all

mkdir ~/temp
cd ~/temp
wget http://plippo.de/dwl/twofing/twofing-0.1.2.tar.gz
That should report that "twofing-0.1.2.tar.gz" was saved.

Now we'll add some needed packages, if any of these are already installed it's OK. We'll update first, and then install them with the following commands.

Code: Select all

sudo apt-get update
sudo apt-get install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev
Now that those are in place we can extract the downloaded twofing-0.1.2.tar.bz file and compile the binary using "make".

Code: Select all

tar -xvzf twofing-0.1.2.tar.gz
cd twofing-0.1.2
make
-- Below has been EDITED to fix /dev/input problem--

Next we need to create a .rules file in "/etc/udev/rules.d"

Code: Select all

sudo nano /etc/udev/rules.d/70-touchscreen-egalax.rules
Put this line in the file, then save and exit.

Code: Select all

KERNEL=="event*",ATTRS{name}=="FT5406 memory based driver",SYMLINK+="twofingtouch",RUN+="/bin/chmod a+r /dev/twofingtouch"
Now copy "twofing" to /usr/bin

Code: Select all

sudo cp twofing /usr/bin/
Now reboot and then we can give it a test.
Test it using the debug switch. If you have no errors you'll get a calibration screen, press <CTRL> C to exit.

Code: Select all

twofing --debug
If that went OK then start twofing again, without the debug switch, and touching two fingers on the window titlebar should give you a "right click" dropdown menu.

Code: Select all

twofing 
Now you'll probably want to start it up when the desktop starts, so let's add it to the autostart file.

Code: Select all

nano ~/.config/lxsession/LXDE-pi/autostart
Scroll down to the bottom and add this line.

Code: Select all

@/usr/bin/twofing 
Save the change, reboot again, and it should be working. If so you can delete the /temp directory and everything in it.

Code: Select all

rm -r ~/temp
Have fun!
Last edited by JimmyN on Sat Mar 05, 2016 1:14 pm, edited 3 times in total.

adastre
Posts: 1
Joined: Fri Mar 04, 2016 7:14 pm

Re: [How To] Two finger touch for right click

Fri Mar 04, 2016 7:28 pm

In fact you can solve the problem of choosing the input by changing the udev rules.
Remplace the content of the file 70-touchscreen-egalax.rules by

Code: Select all

KERNEL=="event*",ATTRS{name}=="FT5406 memory based driver",SYMLINK+="twofingtouch",RUN+="/bin/chmod a+r /dev/twofingtouch"
This will automatic link the good /dev/input/event to /dev/twofingtouch (For the official 7" touchsreen)

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Sat Mar 05, 2016 12:20 pm

Thanks, I knew somebody would come along that knew what to do about the changing inputs. I guess I should edit the instructions to include editing the .rules file, and specifying the alternate input is no longer needed if using "/dev/twofingtouch".

deerewright
Posts: 8
Joined: Thu Oct 15, 2015 2:47 am

Re: [How To] Two finger touch for right click

Sat Mar 12, 2016 10:59 pm

When I do the debug entry I get this:

Code: Select all

~$ twofing --debug
twofing, the two-fingered daemon
Version 0.1.2.20120708

ERROR: Couldn't connect to X server
I then tried without the debug, but am not getting any response on my screen.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Sat Mar 12, 2016 11:27 pm

Using --debug shows you any errors. If it doesn't run with the --debug switch it won't run without it.

You have to run "twofing" from a terminal on the desktop to test it. The "couldn't connect to x server" sounds like you are trying to start it from Putty or some other remote login.

gadgetoid
Posts: 151
Joined: Wed Mar 07, 2012 9:58 pm

Re: [How To] Two finger touch for right click

Wed Mar 16, 2016 4:41 pm

Nice work, JimmyN! :D

Glad the right udev rules cropped up via adastre. I looked blankly at the udev stuff for a long time before deciding I had no chance of figuring it out without an extensive google adventure.

Makro
Posts: 3
Joined: Wed Mar 02, 2016 9:28 pm

Re: [How To] Two finger touch for right click

Wed Mar 16, 2016 8:55 pm

Nice job JimmyN! Thanks for this sharing! :D I'm realy glad to see that RPI community is so dynamic!
Now every one can have a complet functional display on Jessie.

This step by step worked well for my.
Unless the part for runding twofing at boot. For now I can't figure out what the problem is. I'll first search by myself.

CraigV
Posts: 31
Joined: Tue May 21, 2013 11:45 am

Re: [How To] Two finger touch for right click

Thu Mar 17, 2016 7:08 am

Thank you Jimmy and all others that contributed!

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Thu Mar 17, 2016 1:12 pm

Thanks everyone, I see I'm not the only one that really missed having "right click" context menus. :D

ZakAttacks
Posts: 21
Joined: Thu May 01, 2014 3:07 am
Location: Sacramento, California

Re: [How To] Two finger touch for right click

Sat Jun 04, 2016 5:29 am

When setting this up in Ubuntu MATE, everything is the same until you get to the auto start. Ubuntu MATE uses MATE instead of LXDE so obviusly we can't use the method used in this guide. Instead use this:

Code: Select all

mate-session-properties
Click 'Add'
Image
and fill it in
Image
et voila! twofing will now start at boot!

I am proud to say I wrote this entire post on my pi! I actually used twofing to paste the links to the images. Thanks to everyone involved to getting this working!
Also if you have a pi 2 or 3 try out MATE because Ubuntu has better touch support, and it comes with Onboard, which is better than any onscreen keyboard in rasbian.

huczas
Posts: 2
Joined: Thu Jan 17, 2013 12:32 am

Re: [How To] Two finger touch for right click

Tue Jun 07, 2016 8:54 am

How to enable it on different touch screens? I mean my touch screen - http://www.waveshare.com/wiki/7inch_HDMI_LCD_(C)

RaspberryPink
Posts: 1
Joined: Thu Jul 21, 2016 3:31 pm

Re: [How To] Two finger touch for right click

Thu Jul 21, 2016 3:38 pm

Thanks so much for the post. I am getting an error when I run: "twofing --debug"

Here is the output:

Code: Select all

twofing, the two-fingered daemon
Version 0.1.2.20120708

/dev/twofingtouch: No such file or directory
I have verified that my configuration file (/etc/udev/rules.d/70-touchscreen-egalax.rules) is matching the instructions.

I'm running Raspbian Jessie. Any help would be appreciated, thanks!

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Thu Jul 21, 2016 5:34 pm

Try this and see what it shows. twofingtouch should be a linked to an input event

Code: Select all

ls -l /dev/twofingtouch
lrwxrwxrwx 1 root root 12 Jul 14 18:53 /dev/twofingtouch -> input/event0
If that isn't correct it must be something in the "/etc/udev/rules.d/70-touchscreen-egalax.rules" file as that creates the link.
What does the file listing looks like for the rules file?

Code: Select all

ls -l /etc/udev/rules.d/70-touchscreen-egalax.rules
-rw-r--r-- 1 root root 124 Mar  5 07:09 /etc/udev/rules.d/70-touchscreen-egalax.rules
I'm sure you've checked it, probably more than once, but also post the line from your .rules file.

johalareewi
Posts: 5
Joined: Wed Aug 10, 2016 1:15 pm

Re: [How To] Two finger touch for right click

Thu Aug 18, 2016 7:33 pm

Works for me too with my 22 inch Iiyama ProLite T2252MTS touchscreen (aka Quanta OpticalTouchScreen ).
After making twofing, I only needed to create the symlink between /dev/input/event0 and /dev/twofingtouch
The udev stuff wasn't required and I only have the touchscreen (no mouse) so it is always on event0.
Works with Raspbian Jessie and UbuntuMATE 16.04 :)

Code: Select all

cd /tmp
wget http://plippo.de/dwl/twofing/twofing-0.1.2.tar.gz
sudo apt-get update
sudo apt-get install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev
tar -xvzf twofing-0.1.2.tar.gz
cd twofing-0.1.2
make
sudo cp twofing /usr/bin
sudo ln -s /dev/input/event0 /dev/twofingtouch
twofing
But:-
- The /dev/twofintouch link doesn't survive a reboot.
- Some HTML5 web applications that recognise a long mouse click (in Firefox/IceWeasel) don't when twofing is running

And with UbuntuMATE the top menu bar is not easy to two finger click on but when you manage to do it (or use a mouse) there is an option to make the menu bar thicker which makes it easier (I set mine to 40px).

Siggi
Posts: 1
Joined: Mon Aug 29, 2016 6:15 pm

Re: [How To] Two finger touch for right click

Mon Aug 29, 2016 6:22 pm

Hello,

unfortunately, the discribed autostart procedure didn't work for me.
But the variant to implement a autostart command described at adafruit helped me:
https://learn.adafruit.com/adafruit-ras ... at-startup

Just replace

Code: Select all

$ nano tightvnc.desktop
with

Code: Select all

$ nano twofing.desktop
and

Code: Select all

[Desktop Entry]
2.Type=Application
3.Name=TightVNC
4.Exec=vncserver :1
5.StartupNotify=false
with

Code: Select all

[Desktop Entry]
2.Type=Application
3.Name=Twofing
4.Exec=twofing
5.StartupNotify=false
Hope this is helpful for some people.

karazi
Posts: 4
Joined: Thu Dec 10, 2015 3:10 pm
Location: Northern NJ

Re: [How To] Two finger touch for right click

Thu Sep 15, 2016 1:14 am

johalareewi wrote:Works for me too with my 22 inch Iiyama ProLite T2252MTS touchscreen (aka Quanta OpticalTouchScreen ).
After making twofing, I only needed to create the symlink between /dev/input/event0 and /dev/twofingtouch
The udev stuff wasn't required and I only have the touchscreen (no mouse) so it is always on event0.
Works with Raspbian Jessie and UbuntuMATE 16.04 :)

Code: Select all

cd /tmp
wget http://plippo.de/dwl/twofing/twofing-0.1.2.tar.gz
sudo apt-get update
sudo apt-get install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev
tar -xvzf twofing-0.1.2.tar.gz
cd twofing-0.1.2
make
sudo cp twofing /usr/bin
sudo ln -s /dev/input/event0 /dev/twofingtouch
twofing
But:-
- The /dev/twofintouch link doesn't survive a reboot.
- Some HTML5 web applications that recognise a long mouse click (in Firefox/IceWeasel) don't when twofing is running

And with UbuntuMATE the top menu bar is not easy to two finger click on but when you manage to do it (or use a mouse) there is an option to make the menu bar thicker which makes it easier (I set mine to 40px).
Were you able to figure out how to make the /dev/twofingtouch link survive reboot?

flostein
Posts: 3
Joined: Thu Oct 06, 2016 9:27 am

Re: [How To] Two finger touch for right click

Thu Oct 06, 2016 9:45 am

hel!po,
until now i realy get started everything with the raspi. but this one is too tricky for me. are all these tutorials concerning 2 finger touch right click on raspbian jessie fake? please, can someone send me a link to the working image? for this project i realy need the right click! thanks in advance, flo
my setup:
rp3
official 7"touch display

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Thu Oct 06, 2016 12:44 pm

flostein wrote:hel!po,
but this one is too tricky for me. are all these tutorials concerning 2 finger touch right click on raspbian jessie fake? please, can someone send me a link to the working image?
It's not that tricky, my first post at the top contains all the information, just go though it step by step in the correct sequence, all the commands are there, and it will work.

Why would you think this is fake?

There is no Raspbian image that contains the right click function, for the RPF display. No matter which image you use you'll have to add a right click function if you want it.

flostein
Posts: 3
Joined: Thu Oct 06, 2016 9:27 am

Re: [How To] Two finger touch for right click

Sun Oct 09, 2016 11:12 pm

hi jimmy, after going through the process, i stuck here again:
"Now reboot and then we can give it a test.
Test it using the debug switch. If you have no errors you'll get a calibration screen, press <CTRL> C to exit."

- there is no calibration screen after reboot.
- what exactly do you mean by "debug switch"?

i am using the latest raspbian ( Raspbian Jessie with PIXEL)

please help, i need a simple walktrough. there have to be some basics, i dont get. :( sorry.

thanks in advance for your help! kind regards, flo

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Mon Oct 10, 2016 12:09 am

At the command prompt type

Code: Select all

twofing --debug
If you start it without using "--debug" and there is an error it will just die silently and you won't know what's wrong. Using "--debug" it will show any errors, and if there are none and it's working you'll get a calibration screen. There's nothing to calibrate though, so just exit it with a <CTLC> C.

Once you know it's working correctly start it manually with

Code: Select all

twofing
or add it to the autostart file

flostein
Posts: 3
Joined: Thu Oct 06, 2016 9:27 am

Re: [How To] Two finger touch for right click

Mon Oct 10, 2016 12:27 am

HERO OF THE DAY! tx a lot, flo

User avatar
newsordice
Posts: 3
Joined: Thu Dec 01, 2016 6:22 pm
Location: South West, UK
Contact: Website

Re: [How To] Two finger touch for right click

Sat Dec 17, 2016 9:12 pm

Hey I just wanted to say my thanks to the OP and all other contributors. This has helped me successfully implement twofing as a right click alternative. Much appreciated

lsegalla
Posts: 18
Joined: Thu Nov 17, 2016 10:28 pm

Re: [How To] Two finger touch for right click

Sun Jan 01, 2017 7:41 pm

In my case, to have the right-menu working at startup I've added this to the .config/lxsession/LXDE-PI/autostart the following code:

Code: Select all

@sudo ln -s /dev/input/event0 /dev/twofingtouch
@lxterminal -e /usr/bin/twofing

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: [How To] Two finger touch for right click

Mon Jan 02, 2017 11:52 am

That will work, but if you plug in a USB keyboard/mouse the touchscreen input event number will change and the two finger touch function will stop working. The udev rule assures that twofing uses the correct event number for the touchscreen regardless of other input devices that may or may not be plugged in, either before or after boot.

danb1983
Posts: 5
Joined: Mon Jan 09, 2017 12:47 am

Re: [How To] Two finger touch for right click

Fri Jan 13, 2017 5:04 pm

I'm having an issue that when I try to two finger right click the mouse moves to the different spot. Is there a way that I can move the mouse to an item and then click with my other finger without the mouse moving?

Thanks,

Return to “Official Foundation Display”

Who is online

Users browsing this forum: No registered users and 5 guests