How to disable touchscreen on Ubuntu?

Recently I installed Ubuntu 20.04 on my Dell Inspiron 5547 laptop. I have replaced the HDD on this laptop with a SSD, swapped WLAN card with a Killer WLAN card. With Linux running, it’s very fast and responsive. However, I needed to disable the touchscreen on Ubuntu permanently. How to disable touchscreen on UbuntuFound out that there were few different ways I could do it. Also if you have a device with a broken touchscreen it can cause a whole lot of problems, in many cases it’s the sole reason Surface Tablet keeps freezing up.

Disable touchscreen on startup:

Probably the easiest and risk free solution.

Run the following command:

sudo xinput --list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ELAN Touchscreen                          id=10   [slave  pointer  (2)]
⎜   ↳ Synaptics s3203                           id=12   [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)]
↳ Sleep Button                              id=9    [slave  keyboard (3)]
↳ Integrated_Webcam_HD: Integrate           id=11   [slave  keyboard (3)]
↳ Dell WMI hotkeys                          id=13   [slave  keyboard (3)]
↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]

So my touchscreen XID is id=10. On Ubuntu, all I need to do is create a startup command and disable touchscreen ID. You can configure what applications should be started at login, in addition to the default startup applications configured on the system.

  1. Open Startup Applications via the Activities overview. Alternatively you can press Alt+F2 and run the gnome-session-properties command.
  2. Click Add and enter the command to be executed at login (name and comment are optional). In this case, run the command: xinput disable [touchscreen XID] For example, as my XID is 10, then the command would be xinput disable 9. Confirm with Add.

Disable touchscreen though Xorg config

Now the above solution should work as long you’re using some sort of GUI. In case you’re not or it didn’t work, here’s another way.

Instead of using 40-libinput.conf that will be wiped during update,  I wanted a solution that will work post updates. So create a new file that will be loaded later, overriding previous settings.

sudo nano /usr/share/X11/xorg.conf.d/99-disabletouch.conf

And paste the section from 40-libinput.conf like this:

Section "InputClass"
    Identifier "Touchscreen catchall"
    MatchIsTouchscreen "off"
EndSection

Save and reboot.

8 COMMENTS

  1. If the ubuntu machine is restarted I noticed sometimes the xinput id will changes, like before the finger touch use xinput id 13 then next time it uses xinput 14 ( notices this earlier when my keyboard suddenly not working, I check on the startup application configurations apparently its because of that )

  2. “For example, as my XID is 10, then the command would be xinput disable 9.”
    This is a typo, right? Surely the command doesn’t use the XID minus 1.

  3. I had issue on my laptop with touchscreen (random input) and had to disable it. Your method was helpful to disable it in runtime, but after restart XID changed. Second part to disable it permanently did not work for me. I think you have error in syntax – base on xconf manual Identifier does nothing, actual filtering is on boolean MatchIsTouchscreen or MatchIsTablet “on” to catch all devices from that class. To disable it I used Option “Ignore” “on” (or any other boolean value you like).
    Ref xconf manual: https://www.x.org/releases/current/doc/man/man5/xorg.conf.5.xhtml – INPUT CLASS section

    Code snippet I use in 99-disabletouch.conf

    Section “InputClass”
    Identifier “touchscreen disable”
    MatchIsTouchscreen “on”
    Option “Ignore” “true”
    EndSection

    Section “InputClass”
    Identifier “tablet disable”
    MatchIsTablet “on”
    Option “Ignore” “true”
    EndSection

    Thanks for your article I was able to figure that out, thanks!

    • Be careful with suggestion from Maciej Szatkowski. I tried this and couldn’t log in through GUI. I had to delete the file in TTY — that fixed it, but I still have the touch screen issue. I see people recommend that you just turn it off in BIOS. I’m going to try that next.

  4. #!/bin/bash

    notouch.sh

    this gets copied from administrator HOME dir to user/home/

    # We need the time after a person logs in

    Run ‘xinput list’ to see the name of your touch screen and number. The number changes at time so it has to be searched for.

    Make sure you give allow excucuting permissions on this file.

    metouch=eGalaxTouch # <<< change this varible

    sleep 10
    virtual=$(xinput list | grep -io -m1 virtualbox)
    if [ “$virtual” != “VirtualBox” ]; then

    idnumber=”$(xinput list | grep -i -m1 $metouch | sed ‘s/.id=([0-9])./\1/’)”
    len=$(echo ${#idnumber})
    if [ $len = 0 ]; then
    idnumber=”$(xinput list | grep -i -m1 $metouch | sed ‘s/.
    id=([0-9])./\1/’)”
    fi
    len=$(echo ${#idnumber})
    if [ $len = 0 ]; then
    echo “Touch Screen *** $metouch *** not found” > ./touchstat.txt
    echo “Touch Screen *** $metouch *** not found”
    xinput list >> ./touchstat.txt
    else
    echo “yippie!” > ./touchstat.txt
    xinput disable $idnumber
    echo $idnumber >> ./touchstat.txt
    echo $idnumber Disabled
    echo “Touch screen $idnumber disabled” >> ./touchstat.txt
    fi
    fi

    echo “Today is “$(date) >> ./touchstat.txt

Leave your solution or comment to help others.

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

Latest Articles

Discover more from blackMORE Ops

Subscribe now to keep reading and get access to the full archive.

Continue reading