Ubuntu – How to disable/enable/toggle touchpad in a Dell laptop

delltouchpad

I am trying to tweak the touchpad on Ubuntu 16.04 but none of the usual methods seem to work. e.g.

synclient touchpadOff=1

It still works!

$ xinput set-prop $DEVICE_ID "Device Enabled" 0
$ xinput list-props 15 |head -n2
  Device 'SynPS/2 Synaptics TouchPad':
    Device Enabled (168):   0

…it still works!

I can disable it from the Settings app. but I want to be able to map this to a keyboard shortcut, so I'm looking for a command line solution.

Bonus points if you answer works in Gnome-Shell as well as Unity 🙂

EDIT: output of xinput as requested in comment.

$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ELAN Touchscreen                          id=12   [slave  pointer  (2)]
⎜   ↳ DLL06E4:01 06CB:7A13 Touchpad             id=13   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [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)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ Power Button                              id=9    [slave  keyboard (3)]
    ↳ Sleep Button                              id=10   [slave  keyboard (3)]
    ↳ Integrated_Webcam_HD                      id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                          id=16   [slave  keyboard (3)]

Nb. I have used 15 for $DEVICE_ID

EDIT – thanks to the answer below here's my toggle script

You can do it in a one liner, but this way you get a nice notification, too. I've attached this to a shortcut key and it works a charm. Thanks all.

#!/bin/bash
if xinput list-props 13 | grep "Device Enabled (168):.*1" >/dev/null
then
  xinput disable 13
  notify-send -u low -i mouse "Trackpad disabled"
else
  xinput enable 13
  notify-send -u low -i mouse "Trackpad enabled"
fi

Best Answer

You can switch the touchpad off with this command:

xinput disable 13

Enable it back by

xinput enable 13

The device is not controlled by psmouse. It is controlled by synaptics_i2c. And it is device 13.

You can also toggle it by name as you tried before, not to depend on the ID. But if you do not connect new input devices, the ID should stay.

See this answer for some details.

To remove a wrongly detected device you need to add i8042.nopnp kernel boot parameter.