Home Ubuntu Automatically Disable Touchpad When External Mouse Is Connected In Ubuntu

Automatically Disable Touchpad When External Mouse Is Connected In Ubuntu

By sk
Published: Last Updated on 14.6K views

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).

Touch indicator applet icon
Touch indicator applet icon

Just click on it, choose Preferences. Under the Actions tab, enable the option that says "Disable touchpad when mouse plugged".

Disable touchpad when mouse plugged using Touchpad indicator
Disable touchpad when external mouse is connected using Touchpad indicator

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.

Autostart Touchpad indicator
Autostart Touchpad indicator

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 configuration
Touchpad configuration

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.

$ dconf-editor

At first launch, you will the following warning message. Click "I'll be careful" button to continue.

Launch dconf-editor
Launch dconf-editor

From the main interface, search for "Touchpad". Click on the "/org/gnome/desktop/peripherals/touchpad/" folder.

Search for touchpad in dconf-editor
Search for "touchpad" in dconf-editor

In the next window, click "Send-events" tab.

Click send-events option in dconf-editor
Click send-events option in dconf-editor

Click on the "Custom value" drop-down box at the end and choose "disabled-on-external-mouse" option.

Disable touchpad using dconf-editor
Disable touchpad using dconf-editor

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.

Conclusion

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!

Resources:

You May Also Like

9 comments

Fabian Luttman May 15, 2020 - 3:57 am

Hello,
None of these methods work in Ubuntu Mate 20.04.
Any suggestions?
Thanks!

Reply
sk May 15, 2020 - 11:29 am

I am using Ubuntu 20.04 GNOME LTS desktop and gconf method works fine without any issues.I don’t have any MATE DEs right now, so I can’t comment.

Reply
Bob Slomcenski January 3, 2021 - 11:09 pm

I am relatively new to linux and am using Ubuntu 20.04 GNOME LTS desktop. The “gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse” method works great. Does this setting persist across boots or do I have to add a startup command to re-issue it on each boot?
Thanks!

Reply
sk January 4, 2021 - 10:53 am

No need to add it any settings in startup. The setting will persist across system reboots.

Reply
Greg Benner March 8, 2021 - 12:48 am

Ubuntu 20.10 E: Unable to locate package touchpad-indicator

Reply
Brian K. White October 6, 2021 - 2:41 am

The gsettings command has no effect on xubuntu 21.04.

Maybe it just affects some particular software that is just an unsafe assumption by the author? Like maybe it only works under gnome or kde or something and the setting means nothing to xfce?

Reply
sk October 6, 2021 - 10:26 am

It worked well under Ubuntu GNOME at the time of writing this guide. It also works in latest Fedora GNOME edition as well.

Reply
Rijaniaina April 13, 2022 - 9:57 am

It works but when I unplug the external mouse the touchpad is not working.

Reply
sk April 13, 2022 - 10:50 am

It could be something else. As far as I tested, it works perfectly as described in the article.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More