Disabling Portion of Touchscreen on Ubuntu 20.04
In this article, we will discuss the steps to disable a portion of a touchscreen on Ubuntu 20.04. This can be useful in cases where a specific area of the touchscreen is causing issues or is unresponsive.
Prerequisites
Before we begin, make sure that you have the following:
- A system running Ubuntu 20.04
- Access to the terminal
- Sudo privileges
Identifying the Touchscreen Device
The first step is to identify the touchscreen device that you want to disable. To do this, run the following command in the terminal:
xinputThis will list all the input devices connected to your system. Look for a line that starts with "touchscreen" and note down the device ID.
Disabling the Touchscreen Device
Once you have identified the touchscreen device, you can disable it using the following command:
xinput disable [device ID]Replace [device ID] with the ID of the touchscreen device that you want to disable. For example, if the ID of your touchscreen device is 12, the command would be:
xinput disable 12This will disable the entire touchscreen device. If you want to disable only a portion of the touchscreen, you will need to use a different method.
Disabling a Portion of the Touchscreen
Disabling a portion of the touchscreen is a bit more complicated. It involves creating a custom X Input Classifier (XIC) and using it to filter out the unwanted touches. Here are the steps:
- Create a new XIC file using a text editor. For example, to create a file called "touchscreen.xic" in your home directory, you can use the following command:
nano ~/touchscreen.xic- Add the following code to the file, replacing [device ID] with the ID of your touchscreen device and [X and Y] with the coordinates of the portion that you want to disable:
Section "InputClass"
Identifier "touchscreen"
MatchProduct "[device name]"
MatchDriver "libinput"
Option "SwipeLeftDistance" "0"
Option "SwipeRightDistance" "0"
Option "SwipeUpDistance" "0"
Option "SwipeDownDistance" "0"
Option "FingerToMotionNoise" "0"
Option "FingerToPressureNoise" "0"
Option "MinX" "[X]"
Option "MaxX" "[X]"
Option "MinY" "[Y]"
Option "MaxY" "[Y]"
Option "TransformationMatrix" "1 0 0 0 1 0 0 0 1"
EndSection- Save and close the file.
- Load the XIC file using the following command:
xinput create-input-master "Custom Touchscreen"xinput load-xim-rules ~/touchscreen.xicThis will create a new input master called "Custom Touchscreen" and load the XIC file. The portion of the touchscreen that you want to disable should now be disabled.
Re-enabling the Touchscreen
To re-enable the touchscreen or the portion of the touchscreen that you have disabled, use the following commands:
xinput enable [device ID]xinput unload-xim-rules "Custom Touchscreen"- Identify the touchscreen device using the
xinputcommand - Disable the touchscreen device using the
xinput disable [device ID]command - Disable a portion of the touchscreen by creating a custom XIC file and loading it using the
xinput create-input-masterandxinput load-xim-rulescommands - Re-enable the touchscreen or the portion of the touchscreen using the
xinput enable [device ID]andxinput unload-xim-rules "Custom Touchscreen"commands