0

I disabled the touchpad on my Dell XPS 13 to work around a bug (the mouse cursor jumps around randomly as I type, selects text, etc.), possibly in 22.04, but the OS ignores it and the touchpad remains active.enter image description here

Why, you may ask, do I think disabling the touchpad would help? Because I noticed that as long as my hands are far enough away from the touchpad, the problem doesn't occur. So before I open up the laptop and pull the plug on the touchpad, I thought I'd check in here. Has anyone else experienced this in 22.04?

2 Answers2

2

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

user68186
  • 37,461
1

Rather than fully disabling the touchpad, disabling only "Tap to click" will be of equal help to you. The setting is in "Settings", "Mouse & Touchpad". The touchpad remains functional, clicking however now must be done by pressing the touchpad mechanically down.

Personally, I can quickly toggle the setting on or off by hitting Ctrl+Esc. This is effectuated by a small script triggered by that shortcut key. Here is how in case you are interested:

1. Create the script

Using a text editor, copy following script into a file ~/.local/bin/toggletouchpad. If the directory ~/.local/bin does not yet exist, create it then log out and back in so it gets included in your search PATH.

#!/bin/bash
STATUS=$(gsettings get org.gnome.desktop.peripherals.touchpad tap-to-click)
case $STATUS in
    true )
        gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click false
    ;;
    false )
        gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true
    ;;
esac

2. Make the script executable

Use your file manager to set the script executable, or use the terminal: chmod +x ~/.local/bin/toggletouchpad

3. Assign it to a shortcut key

Add a shortcut key in "Settings" - "Keyboard", "Keyboard Shortcuts". As "command", fill in toggletouchpad.

vanadium
  • 97,564