In this guide, I will show you how to auto disable touchpad when mouse is connected in GNOME Linux Laptops.
All Laptops have Touchpad, but not everyone is using it as their primary pointing device. Some users prefers Mouse over Touchpad. Because using a mouse is very convenient and much simpler than touchpad.
Also the location of touchpad makes it prone to accidental touching while you're typing. Sometimes, my palm or wrist accidentally touches the touchpad and moves the mouse cursor while typing. I often face this nuisance and it is quite annoying when I type something important and the cursor jumps all over the screen and messes with the writing.
One way to stop accidental touchpad touches while typing is to disable the touchpad only when you start to type. Once you stop typing, the touchpad will function as usual. When you start typing again, the touchpad will not work. Please note that the touchpad is not disabled permanently. It simply stops working when you are about to start type in your keyboard.
The another way to avoid accidental click while typing on your Laptop is to get an external mouse and automatically disable the touchpad when the mouse is connected. After you unplugged the mouse, the touchpad will work as usual.
In this tutorial, I will walk you through the steps to disable touchpad automatically when an external mouse is connected in GNOME Linux desktops. These methods should work on any Linux distribution that has GNOME desktop environment. I have tested this on Fedora 33, 34 and openSUSE tumbleweed. It worked fine as expected.
Auto Disable Touchpad When Mouse Is Connected In GNOME Desktops
We can disable the touchpad and prevent accidentally moving cursor while typing using gsettings and dconf-editor. First, we will see how to do it using
1. Disable touchpad when mouse is connected using gsettings
This method is specifically for Linux distributions that is installed with GNOME DE.
To disable touchpad when the mouse is connected, run:
$ gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse
The touchpad will be immediately disabled once you run the above command.
You can view the current setting using command:
$ gsettings get org.gnome.desktop.peripherals.touchpad send-events
To enable the mouse again, run:
$ gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
2. Disable touchpad when mouse is connected using dconf-editor
Dconf-editor is a graphical viewer and editor of applications internal settings. It allows editing options not exposed in some applications interface. Please careful while using this tool. If you don't know what you're doing, you probably will break your system.
Dconf-editor comes pre-installed with GNOME Linux distributions. Just in case it is missing for any reason, install dconf-editor using your default package manager.
To install dconf-editor on Arch Linux and its variants, run:
$ sudo pacman -S dconf-editor
On Debian, Ubuntu, POP_OS!:
$ sudo apt install dconf-editor
$ sudo dnf install dconf-editor
$ sudo zypper install dconf-editor
Launch dconf-editor from application menu or terminal by running the following command:
You will see a warning message at first launch. Click "I'll be careful" button to continue.
From the main interface, search for "Touchpad". Click on the "/org/gnome/desktop/peripherals/touchpad/" folder.
Click on "send-events" option in the next window:
In the send-events section, click the "Custom value" drop down box and choose "disabled-on-external-mouse" option.
That's it. From now on, the touchpad will be automatically disabled as soon as you connect a mouse.
Hope this helps.