If you are using one of these recent PCs you can notice they almost come with a touchscreen feature. In search of good PCs, we sometimes have to get ourselves one of those. Unfortunately, that feature can be annoying for us developers and designers. We often need to point our finger at the screen and try to show something to a colleague or to the boss. Things start to mess up anytime you touch that screen. Secondly, this feature can be resource consuming and an overload of the battery as well.
Recently I got myself a Dell(R) Inspiron(R) 5559 which has a touchscreen. The PC comes with Windows 10. As you can guess I got rid of the Windows the first day I bought it and installed Ubuntu 16.04 which I upgraded later to Ubuntu 17.10
Now that I have the OS I want, that screen touch feature started to be a serious annoyance. At first, I thought it would be simple to get a button to switch it on/off since I use GNOME. But, for more than six months of use, I still haven't found that button.
Today, I decided to find a way of disabling that feature. This means looking for commands or config files to fix it. After a few googling the first option I found was to use xinput
.
xinput --list
From that, I can find the device name and ID. With that I can disable it just like this:
xinput "device name" disable
OR
xinput disable id
For example, in my case, xinput --list
displayed the following:
We can see here that my touchscreen is called "Melfas LGD AIT Touch Controller" and it has the id of 11. To disable it I just have to run:
xinput -disable "Melfas LGD AIT Touch Controller"
OR
xinput disable 11
This works like charm. But, the solution works only per session. Once you reboot the machine the screen will remain active. Sometimes, when you logout and sign in back the screen goes back to active state.
How to make it permanent?
To make it permanent, TalkLittle suggested adding a command in the .profile
file to execute that command every time the machines boots. to do that edit the .profile
file by doing:
sudo nano ~/.profile
Then in the file add the following command at the bottom:
xinput | grep 'ELAN Touchscreen' | grep -Po 'id=d+' | cut -d= -f2 | xargs xinput disable
Note: "ELAN Touchscreen" should be replaced by your own device name
I personally don't like this because it has to run all the time I boot the machine.
The ideal solution I found is to disable the device input using xorg.conf. to find the input file cd to /usr/share/X11/xorg.conf.d/
. in there you will see a certain number of files. For most people on ubuntu 16, the input file is 10-evdev.conf
.
On Ubuntu 17.10, I found the file as 40-libinput.conf
. This file contains InputClass
es which can be edited.
To edit it run:
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
In my case this was the class for my touchscreen:
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
You can notice this line: MatchIsTouchscreen "on"
. I just had to change it into MatchIsTouchscreen "off"
.
Save the changes and reboot. You should have some peace now. The next time you want it you can edit the file again by turning it on
.
Hope this helped. Share to help someone else.
Thanks for reading.
Last updated 2022-05-26 UTC