Score:1

Disable Touchscreen Dell XT3 on Ubuntu 23.04

us flag

Laptop Make and Model

  • Dell Latitude XT3
  • Memory : 4 GB
  • Processor : Intel® Core™ i5-2520M CPU @ 2.50GHz × 4
  • Graphics : Mesa Intel® HD Graphics 3000 (SNB GT2)

The Problem

  • Touchscreen becomes glitchy and clicks randomly and does not allow control of mouse cursor.

  • As a result I am unable to login sometimes, because i am unable to type to password in the password box at login.

  • After Log in, I usually disable my faulty touch screen on my laptop using the below command

    xinput set-prop "N-Trig Touchscreen" "Device Enabled" 0 xinput set-prop "N-Trig MultiTouch" "Device Enabled" 0 xinput set-prop "N-Trig Pen stylus" "Device Enabled" 0 xinput set-prop "N-Trig Pen eraser" "Device Enabled" 0

I created a .sh script file to to execute all of these commands on startup The contents of the file are

#!/bin/bash

xinput set-prop "N-Trig Touchscreen" "Device Enabled" 0
xinput set-prop "N-Trig MultiTouch" "Device Enabled" 0
xinput set-prop "N-Trig Pen stylus" "Device Enabled" 0
xinput set-prop "N-Trig Pen eraser" "Device Enabled" 0
  • When i add this script to startup applications, it is running only after login.
  • I want the script to disable the touchscreen at the login screen itself. during boot process itself.

Thus i created a .service file with the below contents

[Unit]
Description=Disable touchscreen on startup
After=lightdm.service

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 6
ExecStart=/usr/local/bin/disable-touchscreen.sh

[Install]
WantedBy=multi-user.target

When i run the script manually using /usr/local/bin/disable-touchscreen.sh it works. But when i check the status of the .service file, it has an error saying "Unable to connect to X server"

Some kindly help me to troubleshoot, why the script is unable to connect to X server when it is called by the service. Thanks.

ec flag
Can you please add to your question (please don't add in comments) the make/model of your laptop? This will help others search for and find issues related to their specific hardware problems. Thanks.
Score:0
it flag

The xinput command configures your X server's view of the keyboard. Running it before you login, and start the X server (or Wayland), does not make sense.

You could login to your GUI, open a terminal and echo "$DISPLAY". Try copying this definition (export DISPLAY=...) to /usr/local/bin/disable-touchscreen.sh, or a wrapper script.

waltinator avatar
it flag
Comments are designed for US to ask YOU questions about your Question. You should [Edit] your question to add information. By updating your Question, and using the formatting buttons, you make all the information available to new readers. People shouldn't have to read a long series of comments to get the whole story. AskUbuntu is a Question and Answer site, not a conversation site. If you have an update, [edit] your Question. If you have a new question, see [Ask].
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.