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
You can switch the touchpad off with this command:
Enable it back by
The device is not controlled by
psmouse
. It is controlled bysynaptics_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.Using gsettings
If you can change settings by
gsettings
, generally it is the preferred option. Since you can enable/disable touchpad from System Settings, and I am pretty sure System Settings does usegsettings
, it looks like the method below should do the job, on your Dell as well.Script to toggle the touchpad
14.04
15.04+
To use it
toggle_touchpad.py
Add the following command to a shortcut:
Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
Explanation
The command to disable touchpad:
for 14.04:
for 15.04 +:
Read the current state
If we use a script to read the current settings by the command:
(14.04), or
(15.04+)
We can make the script set the opposite value, and thus toggle the touchpad.
EDIT; bash version of the toggle script
Just to be complete, and because OP indicated the
python
script(s) worked, but not wanted to usepython
, thebash
version(s) of the two toggle scripts:14.04
15.04+
To put under a shortcut key
toggle_touchpad.sh
put the following command under a custom shortcut:
I'm on 16.04 too. I usually using a little script that I put on a keyboard shortcut. When I execute it turns my touchpad off... But few seconds after it turns on ...
The script:
I don't try to use it before I see your question ...
I used the OP's script, but in my notebook the device id changes at every boot, so I did a little modification.
It works like a charm now.