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.