1. Overview

Touchscreens are often a convenient way to interact with digital media. However, it may present some problems. For example, unexpected touching could result in issues. So, disabling the touchscreen can help us avoid accidental touches. Additionally, touchscreens consume a significant amount of battery on devices like laptops. Therefore, users might choose to disable the touchscreen altogether, which can improve battery life and optimize the system’s performance.

In this tutorial, we’ll explore two methods to disable the touchscreen in Linux.

2. Using xinput

xinput is a command-line tool in Linux. It enables us to view and configure all supported input devices connected to a system.

In addition to this, we can perform various tasks using the xinput tool:

  • view the settings of a specific input device
  • change the default properties of an input device
  • enable and disable devices
  • create configuration files

Now, let’s see how to install and use the xinput tool in Linux.

2.1. Installation

To install the xinput tool on Debian-based systems, we can utilize the apt command:

$ sudo apt-get install xinput

Furthermore, on Arch and Arch-derivatives, we utilize the pacman command to install the xinput tool:

$ sudo pacman -S xorg-xinput

After the execution of the command, let’s check the installation status of the xinput tool:

$ xinput --version
xinput version 1.6.3
XI version on server: 2.4

The installation is complete.

2.2. Disabling Touchscreen

First, we run the xinput tool to view all the input devices connected with the system:

$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=10	[slave  pointer  (2)]
⎜   ↳ ELAN Touchscreen                          id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=9	[slave  keyboard (3)]
    ↳ Wireless hotkeys                        	id=11	[slave  keyboard (3)]
    ↳ HP WMI hotkeys                          	id=12	[slave  keyboard (3)]

The output provides us with the list of input devices along with their unique identity numbers. Knowing the ID numbers is crucial as it enables us to configure specific input devices.

Here, the ID number of the touchscreen device is 13. So, let’s use the ID number to disable the touchscreen device using the xinput tool:

$ xinput disable 13

Thus, we successfully disabled the touchscreen device.

Finally, to enable the touchscreen again, we can use the enable option in the xinput tool followed by the device ID:

$ xinput enable 13

After execution of the command, the touch functionality should start functioning again.

3. Modifying Xorg Configuration File

An alternative approach to disable the touchscreen in Linux is to modify the Xorg display manager configuration file. It contains the settings that determine the communication between the graphical server and system components, such as input devices and hardware. Additionally, the Xorg configuration file can be used for various crucial tasks:

  • defining the layout of input devices and monitors connected with a system
  • enabling as well as disabling X server extensions
  • configuring input devices
  • setting the resolution of monitors

To make use of these features, first, we create a configuration file using the nano editor:

$ sudo nano /etc/X11/xorg.conf.d/sample.conf

Notably, if there’s an existing configuration file, we can edit that using any editor.

In this instance, we add some instructions to the configuration file to disable the touchscreen:

Section "InputClass"
  Identifier "evdev touchscreen catchall"
  MatchIsTouchscreen "on"
  MatchDevicePath "/dev/input/event*"
  Driver "evdev"
  Option "Ignore" "on"

Let’s explore the instructions we inserted in the configuration file. First, we start with the InputClass section, which contains the properties and configurations of input devices. The second line uniquely identifies the target input device. Next, the third line verifies the touchscreen device.

Furthermore, we also specify a path that contains all the configuration files and the driver related to the touchscreen device. Finally, we disable the touchscreen by activating the Ignore option, which tells the evdev driver to ignore any input signal received from the touchscreen device.

The last step is to restart the input device manager in the system to reflect the changes we made.

Typically, the input devices are managed by the udev tool and daemon. Therefore, we restart the udevd service:

$ sudo systemctl restart systemd-udevd.service

After the restart, the touchscreen device should stop working.

4. Conclusion

In this article, we discussed two methods to disable the touchscreen in Linux.

The xinput tool provides detailed information about all input devices. Although it can be used to configure any input device, the changes are temporary and only valid for a particular session.

On the other hand, similar to the xinput tool, we can modify the properties of the input devices using the Xorg configuration files. However, unlike the xinput tool, the changes we make in the Xorg configuration files are permanent.

Notify of
Inline Feedbacks
View all comments