Find the xinput ID for the touchpad
open a terminal and use the command:
xinput list
This will output something like this:
Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SYNA30D2:00 06CB:CE08 id=10 [slave pointer (2)]
⎜ ↳ SYNA30D2:00 06CB:CE08 id=11 [slave pointer (2)]
⎜ ↳ SYNA30D2:00 06CB:CE08 id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
For the next part, try all the ID numbers for the slave pointer to find out which is your touchpad. Mine works with id=12
.
Test
Enter the command:
xinput set-prop N 'Device Enabled' 0 # Disable touchpad
Replace N
with the number in id=. before entering the above command and then try the touchpad to see if it is disabled. If it does not work, use the command:
xinput set-prop N 'Device Enabled' 1 # Enable touchpad
This command will enable the device disabled by the previous command. Note which N
disables the touchpad.
Script
Save the script below as /home/$USER/bin/touchtoggle
.
#!/bin/bash
# Purpose: Toggles the touchpad on and off with keyboard shortcut Ctrl+Z
# set via System settings > Keyboard > keyboard Shortcuts > Custom
Change the ID below to your touchpad ID
ID=12
TOGGLE=$HOME/.touchpadtoggle
if [ ! -e $TOGGLE ]; then
touch $TOGGLE
xinput set-prop $ID 'Device Enabled' 0 # Disable touchpad
else
rm $TOGGLE
xinput set-prop $ID 'Device Enabled' 1 # Enable touchpad
fi
exit 0
Use your file manager to set the script executable, or use the terminal and enter:
chmod +x /home/$USER/bin/touchtoggle
Check if the script works as expected by running it from the terminal by typing:
touchtoggle
Shortcut
If it works assign a keyboard shortcut like Ctrl+Z, or something similar in System settings > Keyboard > keyboard Shortcuts: View and Customize Shortcuts > Custom Shortcuts. Enter the following:
- Name: Toggle touchpad on and off
- Command: /home/$USER/bin/touchtoggle
- Shotcut: Press the shortcut you want
Change $USER
to your username.
Hope this helps