#StackBounty: #touchscreen #xinput #hp-spectre Disable Touchscreen Automatically on Boot in Bash

Bounty: 50

I have a touchscreen laptop that uses Ubuntu (HP Spectre X360). My screen has been replaced a couple of times and so there is a sometimes a problem with the touchscreen that makes it think that it is being touched randomly all over the screen. This makes it impossible to control anything and a reboot is required.

I know how to disable the touchscreen:

In the terminal I type xinput and I am presented with a list, e.g.:

enter image description here

I then find the number that corresponds to the ELAN Touchscreen (in this case 10) and then type:

xinput disable 10

Once the screen is going haywire however, it is too late to do this, as I can’t type anything. So I want to automate this to be typed as soon as I boot my computer and disable the touchscreen automatically every time. But sometimes the number is not 10, it is sometimes 9.

I suppose I need some simple bash screen that inputs xinput but then finds the number that corresponds to the touchscreen and inputs xinput disable #.

Could anyone help me with that please?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.