How to quickly enable/disable touchpad in Xubuntu 14.04 without installing other applications?

That can be easily done with these two commands (inspired by a different answer):

Disable:

synclient TouchpadOff=1

Enable:

synclient TouchpadOff=0

My initial answer was to use

xinput set-prop 15 "Device Enabled" 0

and

xinput set-prop 15 "Device Enabled" 1

where the id number may be other than 15: it can be be found by running

xinput list

I found about these commands in this answer under a question on how to disable the touchpad.


The commands can be added into launchers.

I prefer creating .desktop files (in usr/share/applications or in .local/share/applications) for the two commands to be run easily with a launcher like Whisker Menu, Synapse, etc


Also:

  • by adding them into a single launcher,

  • setting advanced properties like in the image below

enter image description here

(namely 'show last used item' and 'inside button'),

  • and adding two specific icons,

the launcher will always display the current status of the touchpad.

enter image description here


Also it is never a bad idea to assign shortcuts (Settings Manager - Keyboard - Application Shortcuts) to the two commands.


You also can use synclient, like in this answer.

To turn off touchpad:

synclient TouchpadOff=1

To turn on:

synclient TouchpadOff=0

I think this is more convenient way. You don't need to know device id.

So my solution is to create bash script ~/toggle-touchpad.sh:

#!/bin/bash
if synclient | grep --quiet 'TouchpadOff             = 0'; then
  synclient TouchpadOff=1
  notify-send Touchpad Disabled
else
  synclient TouchpadOff=0
  notify-send Touchpad Enabled
fi

Modify file permission:

sudo chmod +x ./toggle-touchpad.sh

Next goto Settings-Keyboard-Application Shortcuts and add new shortcut. Enter path to the script (/home/your_username/toggle-touchpad.sh - for example). Specify shortcut (Fn+F9 in my case).

Done. Now you can toggle touchpad and you will get notification.