Disable the Touch pad on an Ubuntu Laptop When an External Mouse Is Connected.

Featured image by John Petalcurin from Pexels

One of my pet peeves when working on a laptop is the position of the touch pad, relevant to my right hand position. Probably due to my large hands, and the way I rest my palms when typing, the part of my palm that’s at the bottom of the thumb on my right hand typically always makes a connection with the touch pad, so when I’m doing lots of typing, either long form writing, or coding, I inevitably touch the touch pad with my hand, and the mouse cursor shoots all over the place. If I’m very unlucky, it might even copy/paste some text in the process.

For this reason, I always have an external mouse attached when using my laptop for anything other than browsing. And it means I need a way to ensure that the touch-pad is disabled when the external mouse it attached.

For the longest time I’ve been using the open source touchpad-indicator app, which has always just worked. Unfortunately it seems that since Ubuntu 20.04, the app does not work 100% on Ubuntu. It installs and automatically loads, but the icon doesn’t appear in the taskbar, and any attempts to configure it from the command line are unsuccessful.

While I can’t blame the developer of this app for not keeping things up to date, it does mean I have to find an alternative solution. Fortunately I stumbled across one, using the dconf-editor, on the AskUbuntu forums.

Installing dconf-editor is as easy as running:

sudo apt install dconf-editor

And then running dconf-editor from the command line.

The editor exposes MANY configuration settings, which, if you don’t know what you are doing, could quite easily bork your system. It does warn you about this, so you’ve been told!

Once opened, browse to the following settings:


Under the Custom value setting for this item, change it from enabled to disabled-on-external-mouse

Close the editor, restart, and you should be good to go. I tested this with a Bluetooth mouse, and it works perfectly first time.






4 responses to “Disable the Touch pad on an Ubuntu Laptop When an External Mouse Is Connected.”

  1. Chad McCullough Avatar
    Chad McCullough

    Sadly, this didn’t work on my laptop running Ubuntu 20.10. Now, not sure if this matters, but I’m using a USB mouse.

    1. Jonathan Avatar

      I’m sorry to hear that. I’ve been meaning to upgrade my laptop to 20.10 for a bit now, I’ll do so and see if it still works there. Otherwise, the touchpad-indicator might work for you, although it looks like it hasn’t been updated in almost 18 months. https://github.com/atareao/Touchpad-Indicator

  2. linuxuser Avatar

    Working great on Ubuntu 21.10
    Thank you!

  3. B. Anoniem Avatar

    A very good option for XFCE and compatible environments (Lubuntu and some Xubuntu) was brought by Jaimet
    (See here https://askubuntu.com/questions/787433/how-do-i-disable-touchpad-when-using-a-mouse)

    In short I will copy how he solved this with a very simple script.
    Personally I prefer “nano” as an editor. If you like vim or vi , replace the “nano” statement with with your preferred text editor

    1) As root, create /usr/local/sbin/touchpadctl.sh ( sudo nano /usr/local/sbin/touchpadctl.sh ) with the following contents:

    set -o errexit #(equivalent -e)
    set -o nounset #(equivalent -u)

    echo "Usage: ${0} {-enable|-e|-disable|-d}"

    if [ $# -ne 1 ]; then
    exit 1


    if [ ${1} = "-disable" -o ${1} = "-d" ]; then
    logger "${0} is disabling the touchpad"
    echo -n manual > $base_dir/bind_mode
    echo -n $device_id > $base_dir/unbind 2>/dev/null || true
    elif [ ${1} = "-enable" -o ${1} = "-e" ]; then
    logger "${0} is enabling the touchpad"
    echo -n auto > $base_dir/bind_mode
    exit 1

    end of the script ————————————————————————

    2) Make your touchpad control script executable:

    sudo chmod +x /usr/local/sbin/touchpadctl.sh

    3) Now test out your script. To disable the touchpad:

    sudo /usr/local/sbin/touchpadctl.sh -d

    4) and to enable the touchpad:

    sudo /usr/local/sbin/touchpadctl.sh -e

    Because this uses “driver unbinding”, there is no dependency whatsoever on X/xorg/wayland/gnome. As a result, you can use it in udev rules that will function correctly during boot-up:

    As root, create /etc/udev/rules.d/01-touchpad.rules ( sudo nano /etc/udev/rules.d/01-touchpad.rules ) with the following contents:

    KERNEL=="mouse*", ATTRS{phys}=="usb*", ACTION=="add", \
    RUN+="/usr/local/sbin/touchpadctl.sh -disable"
    KERNEL=="mouse*", ATTRS{phys}=="usb*", ACTION=="remove", \
    RUN+="/usr/local/sbin/touchpadctl.sh -enable"

Leave a Reply

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

%d bloggers like this: