5

I want to easily enable/disable laptop touchpad.

I know that could be done by short-keys, but at some point I had the impression that custom shortcuts do not work very well in Freya (Settings-Keyboard-Shortcuts-Custom). That was in beta I think. Now it seems they work ok, just that you need to log out and back in.

1 Answer 1

10

An alternative solution to shortcuts would be to create .desktop files with the same commands. Then, they can be put in usr/share/applications and accessed like other Applications with Super-Space etc.

So, what commands to use?

Do

xinput list

and note the id= for Touchpad.

Let's say that is 15.

The command to disable touchpad is:

 xinput set-prop 15 "Device Enabled" 0

to enable:

 xinput set-prop 15 "Device Enabled" 1

(Replace 15 with the output of "xinput list". Then, these two commands can be added to Settings-Keyboard-Shortcuts-Custom and used with shortcuts.)

So, to create the .desktop files

(I have Gedit as text editor here):

sudo gedit /usr/share/applications/disable_touchpad.desktop

With the lines:

[Desktop Entry]
Name=Disable touchpad
Comment=Set your touchpad preferences
Exec= xinput set-prop 15 "Device Enabled" 0
Icon=/usr/share/icons/HighContrast/256x256/status/touchpad-disabled.png
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;System;

Also:

sudo gedit /usr/share/applications/enable_touchpad.desktop

With the lines:

[Desktop Entry]
Name=Enable touchpad
Comment=Set your mouse and touchpad preferences
Exec= xinput set-prop 15 "Device Enabled" 1
Icon=/usr/share/icons/HighContrast/256x256/devices/input-touchpad.png
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;System;

Now, just use the Super-Space launcher and type the first letters of 'touchpad', 'enable' or 'disable'.

enter image description here

4
  • Old post, @cipricus but you really saved my day. Thankyou! I searched for any way to disable my Bamboo's touch, but all forum tips centered around using the "xsetwacom" command to disable touch (which didn't work). Going at it via the xinput command was the answer, thankyou.
    – user8044
    Commented Jan 8, 2017 at 14:43
  • credit should go to some links that I wasn't patient enough to look for on askubuntu :) but thanks for reminding me, HERE it is ~~~ and your post belongs in a comment not an answer :)
    – user170
    Commented Jan 8, 2017 at 15:19
  • 1
    Yes, sorry. I didn't have enough reputation to comment! I'm a new user.
    – user8044
    Commented Jan 9, 2017 at 17:55
  • probably things had changed since this worked, now it is not working on Ubuntu 18.04.
    – efsandino
    Commented Apr 2, 2021 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.