A few days ago, I've found a way to automatically disable Touchpad when external an mouse is connected in Ubuntu. Because, my palm accidentally touches the touchpad and messes up with my writing when I type something. Some of you may not like this idea of disabling Touchpad altogether or you don't have an external mouse and you're still dealing with accidental touch on the Touchpad while typing. If so, here are four different ways to automatically disable Touchpad when typing in Ubuntu and its variants. Please note that we are not going to completely disable the Touchpad, but only when we type something in the Keyboard. I have tested the following methods on Ubuntu 18.04 LTS desktop. I guess it will work on other Ubuntu-like distros as well.
Automatically Disable Touchpad When Typing In Ubuntu
We are going to do this in three ways (both from CLI and GUI). You can choose whichever method works for you. First, let us try the graphical way which is easy for newbies.
Method 1 - Using Touchpad Indicator utility
Touchpad Indicator is small, graphical utility that will help you to configure Touchpad.
The developer of this tool has created a PPA to make the installation much easier! Open your Terminal and run the following commands to install Touchpad Indicator on your Ubuntu system.
$ sudo add-apt-repository ppa:atareao/atareao
$ sudo apt update
$ sudo apt install touchpad-indicator
Once Touchpad Indicator is installed, launch it from Menu or application launcher. It will create a little applet icon on your panel (taskbar).
Just click on it, choose Preferences. Under the Actions tab, check the box that says enable "Disable touchpad on typing". Click OK and close Touchpad indicator application.
Done! From now on, whenever you start type something, the Touchpad will automatically be disabled. When you stop typing, touchpad will start work again.
This method will work on any DEs. The following methods for GNOME DE only.
Method 2 - Using gsettings command
gsettings is a commandline interface to GSettings which allows us to get, set or monitor an individual key for changes.
This is the easiest and straight-forward method I could find. All you have to do is just copy/paste the below command to disable Touchpad when typing.
$ gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing true
This command will immediately disable the Touchpad when you start typing.
To enabled it back, simply do:
$ gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing false
You can view the current setting using command:
$ gsettings get org.gnome.desktop.peripherals.touchpad disable-while-typing
Method 3 - Using dconf-editor
This is just the graphical way of above method. In the previous method, we disabled Touchpad from command line. Now we will do the same using a graphical tool named "dconf". It is a simple configuration system designed for storing desktop environment settings. The main purpose of this tool is to provide a backend to GSettings on platforms that don't already have configuration storage systems. You can tweak various settings from "dconf" using a graphical editor called "dconf-editor".
Run the following command to install dconf-editor if it is not installed already:
$ sudo apt install dconf-editor
Once installed, launch it by typing the following command from the Terminal. You can also launch it from Dash.
At first launch, you will the following warning message. Click "I'll be careful" button to continue.
From the main interface, search for "Touchpad". Click on the "/org/gnome/desktop/peripherals/touchpad/" folder.
In the next window, enable the "disable-while-typing" option. Just click on ON/OFF slider button to switch between settings.
That's it! Close the Dconf-editor. You will now notice that the Touchpad gets automatically disabled when you type something in your keyboard.
Method 4 - Using Syndaemon
Syndaemon is command line program that monitors the keyboard activity and disables the Touchpad when the keyboard is being used. To know how to disable touchpad while typing with the help of Syndaemon, refer the following link.
Hope this helps.