I am not comfortable working with the Touchpad of my Laptop. So I bought an external USB mouse. One minor problem I face often is my palm accidentally touches the touchpad and messes up with my writing when I type something. Sometimes, I accidentally close the application. It happened multiple times and is very annoying. I could easily disable the Touchpad from the Settings in my Ubuntu desktop, but I didn't want to do it. I wanted an easy and reliable way to automatically disable Touchpad when external Mouse is connected in Ubuntu desktop.
After a quick Google search, I found the following methods to disable Touchpad or other pointing devices when an external mouse is plugged in. Even though this guide is specifically written for Ubuntu, some of these methods might work on other Linux distributions as well.
Disable Touchpad when external mouse is connected in Ubuntu
I tested these methods on Ubuntu 18.04 LTS desktop and they worked just fine. If you're ever wanted to disable the touchpad when a Mouse is connected, one of these methods will definitely help.
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, enable the option that says "Disable touchpad when mouse plugged".
Click OK and close the application. From now on, whenever you plug in an external mouse, the touchpad will be automatically disabled.
It is also recommended to start it automatically on every reboot, so you need not to manually start Touchpad indicator each time. To do so, go to "General options" tab and enable "Autostart" option.
Like I already mentioned, we can do a couple more things using this tool as listed below.
- Enable/disable Touchpad,
- Disable Touchpad while typing,
- Enable/disable natural scrolling,
- Enable/disable tapping,
- Adjust Touchpad speed,
- Enable/disable two finger scrolling,
- Enable/disable edge scrolling,
- Disable Touchpad when an external mouse is plugged in.
Some of you might want to disable Touchpad while you are typing. If so, go to Actions tab and enable "Disable touchpad on typing" option.
For more details, check the following guide:
To configure scrolling, tapping and touchpad speed etc., go to "Touchpad configuration" tab and enable/disable the respective option.
Touchpad Indicator is simple, fully functional and useful tool to configure Touchpad in whichever way you please. This tool is recommended for newbies and those who prefer GUI over CLI in general.
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.
$ gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse
This command will immediately disable the Touchpad if an external mouse is plugged in.
To enabled it back, simply do:
$ gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
You can view the current setting using command:
$ gsettings get org.gnome.desktop.peripherals.touchpad send-events
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".
To install dconf-editor, run the following command from your Terminal:
$ 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, click "Send-events" tab.
Click on the "Custom value" drop-down box at the end and choose "disabled-on-external-mouse" option.
Finally, click the tick mark at the far right end to save the settings and close dconf-editor.
Done! Now the touchpad will be automatically disabled once you connect the external mouse.
These are the three different methods that I know to disable Touchpad when an external mouse is connected in Ubuntu-based systems. Use whichever method works for you. Good luck!