56

I can disable my touchpad but if I'm away from my bluetooth mouse or forget my wireless dongle for my backup mouse, I'm SOL. Linux Mint had a nice setting that allowed the touchpad to be disabled when using a mouse. I'm now on Ubuntu MATE 16.04 and do not have that setting. How can I get that functionality? The turn off touchpad while typing option is not enough to prevent light touches of my palm to FU something I'm working on.

I've read other similar questions on here and was unable to find an answer for this exact issue.

Jacob Vlijm
  • 82,471
  • 12
  • 195
  • 299
  • @vanadium Nothing to do with Mate specifically. – Jacob Vlijm Aug 21 '20 at 10:39
  • @JacobVlijm How to change the touchpad settings will depend on the used desktop. For example, the answer with 75 upvotes will work on Gnome, and likely it works the same on Mate, but it will not work on KDE desktop and I am not sure about xfce, except perhaps since they moved to GTK3.. – vanadium Aug 21 '20 at 10:43
  • @vanadium sure, but making it specifically Mate-related suggests it is a Mate thing, which it isn't. No Gnome based distro has this in its GUI Settings, while it can be set in gsettings. – Jacob Vlijm Aug 21 '20 at 10:47
  • @JacobVlijm gsettings is a GTK3 thing, and a setting as org.gnome.desktop will only be applicable for desktops that use underlying Gnome 3 parts. Mate was forked since Gnome 2, so not sure if such a gsetting may also apply to Mate. – vanadium Aug 21 '20 at 15:58
  • @vanadium in the days of the answer, I even installed Mate to make sure, so yes, it does. – Jacob Vlijm Aug 21 '20 at 16:26
  • Never heard of gsettings, being gtk3 thing btw. @vanadium – Jacob Vlijm Aug 21 '20 at 16:28
  • @JacobVlijm KDE uses an entirely different framework to manage settings. Window managers without a desktop environment can run with text configuration files only. dconf is developped by the Gnome project. That it would be a "GTK3" thing indeed may have been inaccurate from my part, :=) although dconf was developped with Gnome 3 – vanadium Aug 21 '20 at 16:32
  • @vanadium interesting! Always thought it was originally Gimp Toolkit https://nl.wikipedia.org/wiki/GTK-toolkit – Jacob Vlijm Aug 21 '20 at 16:40
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/112077/discussion-between-jacob-vlijm-and-vanadium). – Jacob Vlijm Aug 21 '20 at 16:47

5 Answers5

92

On Gnome-based distros, you should be able to disable the touchpad, if an external mouse is connected, by the command:

gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse

To get the current situation:

gsettings get org.gnome.desktop.peripherals.touchpad send-events

Options are:

enabled
disabled
disabled-on-external-mouse
Jacob Vlijm
  • 82,471
  • 12
  • 195
  • 299
  • i dont think the touchpad will get jealous of the mouse ;) – Trey Gordon Jun 15 '16 at 17:29
  • 8
    The above command to disable did not work. It now shows disabled-on-external-mouse but the touchpad still works with either my bluetooth mouse or wireless mouse connected. –  Jun 15 '16 at 17:30
  • @ABeardedTerran that is odd. As a quick workaround, would a shortcut key to toggle disable/enable do? – Jacob Vlijm Jun 15 '16 at 17:32
  • Sure. I ran the following if this sheds any light on the matter. xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ETPS/2 Elantech Touchpad id=12 [slave pointer (2)] ⎜ ↳ TECKNET BM306 id=14 [slave pointer (2)] –  Jun 16 '16 at 20:16
  • @ABeardedTerran sorry, totally forgot this question. Still lokking for a solution or did you manage? – Jacob Vlijm Jun 27 '16 at 12:42
  • No. Back on Linux Mint again, version 18 no longer has what version 17 had in turning off the touchpad when a mouse us in use. I'd think this would be a popular request. –  Aug 11 '16 at 17:24
  • 11
    Works for me on Ubuntu 16.10. My only regret is that I have but one upvote to give. –  Nov 04 '16 at 01:04
  • 1
    I'm lacking a mischief of mice to test on, but it seems the disabled-on-external-mouse works for wired mice but not wireless mice. – Brent Jan 26 '17 at 18:46
  • 2
    I can confirm that this is working for me on Ubuntu 16.04 with Bluetooth mouse. As soon as my mouse gets connected, the touchpad gets disabled. This is simply beautiful! :) – Muhammad bin Yusrat Feb 21 '17 at 18:31
  • 2
    Did not work on my ubuntu 16.04 – Paul Praet Apr 30 '17 at 09:29
  • This still disables the touchpad if there is a dongle but no mouse connected. It would be sweet if the touchpad could be enabled if there is a dongle, but no mouse connected. Not sure if that's possible though. – Dylan Vander Berg Jun 15 '17 at 01:42
  • 1
    Using 17.10 w/ MS Arc BT mouse and this doesn't work. – Tsar Bomba Oct 25 '17 at 14:56
  • Worked for me on 17.10 with Logitech wireless mouse. – Brannon Nov 10 '17 at 02:57
  • Unfortunately, this solution is not reliable. It might or might not work for you. For me, it doesn’t work anymore. – kleinfreund Feb 04 '18 at 18:56
  • Interestingly enough, this work when I first changed the setting as advertised (touchpad got disable), and when I disconnect the USB-mouse the touchpad got enabled. But when I again connected the USB-mouse the touchpad remained enabled... – helmesjo Apr 15 '18 at 07:39
  • 2
    disabled-on-external does not work on 18.04, whereas disabled works :) which is certainly not desired. – aitchkhan May 02 '18 at 10:13
  • weird, works fine for me on 18.04! – workflow Jun 26 '18 at 11:26
  • @workflow yep, the path is still the same :) – Jacob Vlijm Jun 26 '18 at 11:36
  • yes, I confirm that this works wonders for me on Ubuntu 16.04! – Bharat Mallapur Jul 17 '18 at 18:46
  • Worked for me on Ubuntu 20.04 – AneesAhmed777 Jul 19 '20 at 15:25
  • 1
    The `disabled-on-external-mouse` does not work on `18.04`. – ar2015 Apr 24 '21 at 07:33
  • Not working in Ubuntu Mate 20.04 – German Garcia May 22 '21 at 23:13
  • Worked for me on 22.10 – Louis-Rémi Jan 21 '23 at 22:39
  • 1
    On 22.10 It works when i connect to external mouse, the touchpad disable. But the touchpad not re-enable after I disconnect external mouse. – Sai Naw Kham Apr 01 '23 at 07:33
6

There is also a program which introduces some GUI to edit some such settings.

sudo add-apt-repository ppa:atareao/atareao
sudo apt update
sudo apt install touchpad-indicator

Read a more detailed instruction set at https://itsfoss.com/disable-touchpad-when-mouse-used/

Angelorf
  • 180
  • 1
  • 6
  • The other solutions seemed long or didn't work... Installed touchpad-indicator started it, set the setting, worked. – Fabian N. Jul 10 '18 at 20:47
  • Also love the option to disable touchpad on typing! – Nash Nov 01 '18 at 08:53
  • Thank you for this, finally! I thought I was going crazy, all those dialogs "mysteriously" closing, cursor jumping around the doc, I was banging my head (and my laptop) constantly in frustration! Disabled my touchpad, the buttons, the track mouse - all of it, and seems to reliably enable them when external mouse is disconnected. + with the status notification on the top bar - I always know where I stand. – Moshe Eshel Nov 30 '18 at 14:51
  • I don't see any icon on the system tray after installing it. – Ziyuan Sep 27 '22 at 10:53
6

If you are afraid of the terminal you can use the dconf-editor: dconf-enable-touchpad-image

jl005
  • 163
  • 1
  • 10
3

I realise that I'm a bit late to the party (and also that my answer is not specific to ubuntu-mate), but here goes...

I have very similar requirements to you but I run xfce on debian 9 (stretch) so I have no gnome/gsettings installed. To disable/re-enable the synaptics touchpad whenever I plug-in/unplug a usb-mouse, I use udev rules to trigger a (posix) shell script that unbinds/rebinds the synaptics touchpad driver:

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

    #!/bin/sh
    set -o errexit #(equivalent -e)
    set -o nounset #(equivalent -u)
    
    usage(){
      echo "Usage: ${0} {-enable|-e|-disable|-d}"
    }
    
    if [ $# -ne 1 ]; then
      usage
      exit 1
    fi
    
    base_dir=/sys/bus/serio/drivers/psmouse
    device_id=serio1
    
    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
    else
      usage
      exit 1
    fi
    
  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
    

    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:

  1. As root, create /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"
    

As with all things linux, your mileage may vary - you might need to "tweak" it, but I've tried my best to make it easy to understand. For more information re driver binding/unbinding, read Greg Kroah-Hartman's 2005 article in Linux Weekly News and there's also some good info in the kernel source. For more information re writing udev rules, have a look at Daniel Drake's excellent tutorial.

jaimet
  • 166
  • 2
1

On Kubuntu 16.04 you can just go to SystemSettings->Input Devices->Touchpad->Enable/Disable Touchpad

Now select disable when mouse is plugged in.

  • When I disable the touchpad, exit from settings and later come back, there's no option to turn the touch pad back on! – Brian Borchers Jun 30 '17 at 22:00
  • The Unity version of settings does have the option to turn the touchpad back on, while the gnome version of settings doesn't allow me to turn the touchpad back on. Iwas able to get the touchpad turned back on in Unity. – Brian Borchers Jun 30 '17 at 22:34