How do I disable the touchpad while typing (Ubuntu 18.04)?

Solution 1:

I did it this way:

sudo apt remove xserver-xorg-input-synaptics
sudo apt install xserver-xorg-input-libinput
sudo reboot

On my machine I had both of them, so synaptics was default, deleting it helped me. Do not forget to reboot.

Solution 2:

Assuming your system is using libinput, not synaptics, here is the correction. Copy the following place in /etc/X11/xorg.conf.d/90-libinput.conf. Must log out to trigger a re-load of X11.

The change that affects the touchpad while typing is in the second to last line. In my case, I have some boiler plate that channels all of the action to the libinput driver, that may not be strictly necessary. HOwever, I'm certain that the last stanza is your magic bullet.

# Match on all types of devices but tablet devices and joysticks
Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "MyTouchpad"
        MatchIsTouchpad "on"
        Driver "libinput"
        Option "Tapping" "on"
        Option "DisableWhileTyping" "on"
EndSection

Solution 3:

Install gnome-tweaks

sudo apt install gnome-tweaks

and open it.

Under the tab Keyboard & Mouse you will find in the main window under Touchpad the switch Disable While Typing.

enter image description here