Is there a way to disable a touchpad using a terminal command?

up vote 49 down vote accepted

To turn off touch pad:

synclient TouchpadOff=1

To turn it back on:

synclient TouchpadOff=0
  • Simple but go to the point. – Ade Malsasa Akbar Oct 2 '14 at 5:24
  • 4
    does not work on my computer... – Kin Nov 11 '14 at 15:41
  • Interesting, good to know. – aleroxac Jan 29 '16 at 13:48
  • 2
    The command ran without error on my Ubuntu 14.04 LTS on Dell XPS 13 but had no effect. – I. J. Kennedy Feb 23 '16 at 3:53
  • Toggle would be nice -- I would like to set it up as a short cut or something. Better yet, when it's docked, I want the touchpad off – Christian Bongiorno Mar 17 '16 at 5:00

There are at least two methods (that I know of) you could try.


If your laptop is equipped with a Synaptics (or ALPS) touchpad you can indeed use synclient as already mentioned by Shutupsquare. I'm running Ubuntu 14.04 and on my machine it was installed by default.

Test if synclient is installed: synclient -V (it should report the version number)

Turn touchpad ON: synclient TouchpadOff=0

Turn touchpad OFF: synclient TouchpadOff=1

I have not tested this myself, but if your goal is to not move the mouse when your arms are resting on the touch pad, this might help.

Turn palm detection ON: synclient PalmDetect=1

Turn palm detection OFF: synclient PalmDetect=0

In general you can configure any property of your Synaptics touchpad by synclient property=value. Where the property is one of the available properties shown by synclient -l

Links for further reading

ubuntu - comminity help wiki - SynapticsTouchpad

archlinux - wiki - Touchpad Synaptics

ask ubuntu - How do I make my synclient settings stick? - Ubuntu


If you do not want or cannot use synclient, you could also use xinput. The procedure is somewhat similar.

list all xinput devices: xinput

Part of the ouput could look like this:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=13   [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=17   [slave  pointer  (2)]

It this particular case my touchpad has id=17 and its full name is "ETPS/2 Elantech Touchpad".

The command to set a property is xinput set-prop. The property to enable or disable the touchpad is Device Enabled, so to enable or disable it type:

Turn touchpad ON: xinput set-prop <id> "Device Enabled" 1 (where <id> is your device id, in my case 17)

Turn touchpad OFF: xinput set-prop <id> "Device Enabled" 0

Turn palm detection ON: xinput set-prop <id> "Palm Detection" 1

Turn palm detection OFF: xinput set-prop <id> "Palm Detection" 0

To query available properties: xinput list-props <id> OR xinput list-props <full-name>, this should be quite similair to synclient -l.

Links for further reading

ubuntu - wiki - input


When setting properties through either xinput or synclient the properties are not set to the other tool. They are also not set in unity-control-center.

  • 1
    Thanks for the second answer. synclient didn't work for me, xinput did. – Robin Winslow Nov 18 '14 at 12:18
  • 1
    Note that xinput ids can change over restarts. So relying on these ids in scripts or shortcuts won't work. – Lode Jul 17 '15 at 17:47
  • synclient totally works on Arch Linux. Thank you so much!!! – Theodore R. Smith Dec 15 '16 at 17:24
  • This did it for me. In particular, I discovered I need to run xinput <enable/disable> <id>, as setting TouchpadOff via synclient was ineffective. – Michael Mol Mar 24 at 14:43

synclient and xinput will not work if you are using gnome (or unity, cinnamon) environment, because it will override settings, so if you want synclient or xinput to take over these settings, you should disable that first:

  1. install dconf-editor if not installed:

    apt-get install dconf-editor
  2. run dconf-editor

  3. open the directory /org/gnome/settings-daemon/plugins/mouse/ or /org/cinnamon/settings-daemon/plugins/mouse/, and unclick the checkbox for active.

  4. logout or reboot

This should make synclient or xinput work.

  1. List your input devices:

    xinput list

    In my case I have this list:

    Virtual core XTEST pointer                  id=4
    Logitech M510                               id=11   
    ETPS/2 Elantech Touchpad                    id=15
  2. Disable your touchpad by passing the ID

    xinput set-prop 15 "Device Enabled" 0
  • When typing manually, you can use xinput enable [device] and xinput disable [device] directly. When scripting though, using set-prop [device] "Device Enabled" [value] may be a bit easier, as in World Python Developer's answer. – hsandt Oct 24 at 13:48

I wrote a python piece of code so that you can use the xinput technique without doing all the manual work. Copyleft, AS-IS, no warranty, use at your own risk. Works great for me: and if you are using gnome, just map it to a key shortcut like CtrlShiftT.

# -*- coding: utf-8 -*-
'''Program to toggle Touchpad Enable to Disable or vice-versa.'''

import commands
import re

def current_id():
    """ Search through the output of xinput and find the line that has the
    word TouchPad.  At that point, I believe we can find the ID of that device."""

    props = commands.getoutput("xinput").split("\n")
    match = [line for line in props if "TouchPad" in line]
    assert len(match) == 1, "Problem finding Touchpad string! %s" % match

    pat = re.match(r"(.*)id=(\d+)", match[0])
    assert pat, "No matching ID found!"

    return int(

def current_status(tpad_id):
    """Find the current Device ID, it has to have the word TouchPad in the line."""

    props = commands.getoutput("""xinput list-props %d""" % tpad_id).split('\n')
    match = [line for line in props if "Device Enabled" in line]
    assert len(match) == 1, "Can't find the status of device #%d" % tpad_id

    pat = re.match(r"(.*):\s*(\d+)", match[0])
    assert pat, "No matching status found!"
    return int(

def flop(tpad_id, status):
    """Change the value of status, and call xinput to reverse that status."""
    if status == 0:
        status = 1
        status = 0

    print "Changing Device #%d Device Enabled %d" % (tpad_id, status)
    commands.getoutput("""xinput set-prop %d "Device Enabled" %d""" % (tpad_id, status))

def main():
    """Get curent device id and status, and flop status value."""
    tpad = current_id()
    stat = current_status(tpad)
    flop(tpad, stat)


On Gnome, my function key to toggle the touchpad was not working for some reason, so I made a script using gsettings.

  • Advantage: not vendor-specific
  • Disadvantage: on Gnome, the touchpad clicks (not tap) are still handled for some reason, whereas the xinput solution completely deactivates the touchpad as expected. If like me, your only problem is that you are inadvertently moving the cursor while typing, though, that will be enough.

import sys
import subprocess

gsettings_schema, gsettings_key = "org.gnome.desktop.peripherals.touchpad", "send-events"

def get_touchpad_send_events():
    send_events_value = subprocess.check_output(["gsettings", "get", gsettings_schema, gsettings_key])
    return send_events_value.strip()

def toggle_touchpad():
    # string returned from get is a repr including quotes,
    # but string sent with set does not need to have quotes
    if get_touchpad_send_events() == b"'enabled'":
        newval = 'disabled'
        newval = 'enabled'
    subprocess.Popen(["gsettings", "set", gsettings_schema, gsettings_key, newval])
    print(f"Set {gsettings_schema}:{gsettings_key} to {newval}")

def main():

if __name__ == '__main__':

It should also work on Unity, but I haven't tested.

protected by souravc Dec 30 '16 at 11:57

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.