3

This touchpad is driving me nuts. I'd like to replace it with an external wired mouse, which I'll have to obtain (an optical USB mouse I had lying around wasn't recognized). Will it automatically disable the touchpad on mounting or do I have to tell the system to ignore the touchpad?

Someone asked a similar question 5 years ago, but I don't see an answer other than a query about the version being used. (I'm still looking for how to find what version of Xubuntu I'm running. I think it's the latest.)

3
  • 1
    On most notebooks there is a keyboard combination that disables the touchpad.
    – FedKad
    Jan 26, 2022 at 19:44
  • On my Thinkpad, there is a selection in the BIOS to enable or disable the touchpad.
    – chili555
    Jan 26, 2022 at 22:17
  • If you do not see an option in your Mouse/Touchpad settings to do this, then this answer from a few years ago should work just fine. It works across distributions and desktop environments, too 👍🏻
    – matigo
    Jan 27, 2022 at 0:10

4 Answers 4

1

Ref: https://itsfoss.com/disable-touchpad-when-mouse-used/

To install:

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

AutoStart:

  • Hit Win key / Super and type Startup,
  • click Startup App...
  • click Add and type /usr/bin/touchpad-indicator for Command,
  • and anything appropriate (free text) in the other two fields.
  • Click save.

To remove, the general sequence:

  • apt uninstall / purge
  • ... and then
  • apt-add-repository --remove
1
1

The management of peripherals is not the same between versions of Ubuntu (a shame IMO: we don't need a so versatile system that implies Computer Assisted Waste of Time at each upgrade)

For disabling the touchpad when plugging a mouse :

  1. On Ubuntu 20.04, before moving to Ubuntu 22.04 LTS, I used touchpad-indicator mentioned above, that can be installed with Synaptic.
  2. On Ubuntu 22.04, i'm now testing a Dconf editor solution I found here. Just changing the /org/gnome/desktop/peripherals/touchpad/send-events setting to disabled-on-external-mouse. No need of an external program. After a few tests, it seems running very well. The default value can be set back just by clicking the Use default value.

N.B: Sorry! As a non native speaking English, the names of the versions of Ubuntu are unrememberable. They may be very poetic for people having good skill in English, but they are very odd for me. 20.04, 22.04 are just fine.

0

I found settings for mice in Dell Latitude Setup, where I was able to select Disable mousepad on attaching PS2 mouse (or words to that effect).

Was also able to adjust screen brightness there.

0

The answer is written for Ubuntu 22.04 LTS (Jammy Jellyfish) that has libinput driver (module) instead of old synaptics driver that was in older Ubuntu versions.

Download and run script that auto disable touchpad on usb mouse plug in.
The script will work if you have one touchpad only!
You may have as many mice as you want.
If you need silent version of the script then remove all echo and notify-send commands (the script file lines).
FYI I am not a bash scripts' expert and I wrote the script for myself, I think the script may be optimized but for me it is enough.
FYI 2 If you have KDE you may find suggestions to install a synaptics driver (module) instead of libinput (default driver). In my case it does not help at all because KDE touchpad configuration has some errors when I use synaptics driver.

If you have non standard touchpad with word "Mouse" in its name then you need to modify the script by adding the name to FAKE_MCOUNT variable of the script to exclude the touchpad device from detection algorithm. For example I have ASUS laptop and ELAN touchpad that have "Mouse" word in its name, so the script need to know that it is not a mouse. You can see word ELAN in the script and how it is used. The script uses that regular expression do find needed usb mouse plug-in event.

# Execute these commands one by one.

# print list of devices to check if you have a touchpad
# with "Mouse" word in its name
# unplug your actual mouse before executing the command
# If you have such touchpad then you need to modify FAKE_MCOUNT variable of the script
xinput list

# install curl utility to download a stuff
sudo apt install curl

# install utility to show notifications
sudo apt install libnotify-bin

# download and run the script
sudo curl -L https://gitlab.com/blog.awesomesoft/blog.awesomesoft/-/raw/master/src/linux/sh/off_touchpad_on_usb_mouse.sh -o ~/off_touchpad_on_usb_mouse.sh

sudo chmod a+rx ~/off_touchpad_on_usb_mouse.sh

~/off_touchpad_on_usb_mouse.sh

At the moment the script looks like

#!/bin/bash

# The script listen mouse plug in event. And when mouse is pluged in then touchpad will be off.
# The script works with one touchpad only!
# The script works with USB mouse only (or mouse that emulate USB connection)!
# The script works with any quantity of usb mice.

TID=`xinput list | grep -Eo '\sTouchpad\s+id\=[0-9]{1,}' | grep -Eo '[0-9]{1,}'`
MCOUNT=`xinput list | grep -Eo '\sMouse\s+id\=[0-9]{1,}' | grep -c ^`

# Fake touchpad count
# Add any fake touchpad to the expression, you can find it with "xinput list" command
#
# e.g. ELAN is an ASUS touchpad that have "Mouse" word in its name
# https://github.com/mishurov/linux_elan1200_touchpad
FAKE_MCOUNT=`xinput list | grep -Eo 'ELAN.+\sMouse\s+id\=[0-9]{1,}' | grep -c ^`

echo mouse count $MCOUNT
echo fake mouse count $FAKE_MCOUNT

MCOUNT=$((MCOUNT-FAKE_MCOUNT))

echo actual mouse count $MCOUNT

function inc_mouse_count {
    MCOUNT=$((MCOUNT+1))
    echo current mouse count $MCOUNT
}
function dec_mouse_count {
    MCOUNT=$((MCOUNT-1))
    echo current mouse count $MCOUNT
}
function touchpad_off {
    if [ $MCOUNT -eq 1 ]
    then
        xinput --disable $TID
        notify-send "Touchpad is OFF."
    fi
}
function touchpad_on {
    if [ $MCOUNT -lt 1 ]
    then
        xinput --enable $TID
        notify-send "Touchpad is ON."
    fi
}

if [ $MCOUNT -gt 0 ]
then
    touchpad_off
else
    touchpad_on
fi

# RegExp explanation https://www.debuggex.com/r/4aJKR6XKjYFO1-1o
udevadm monitor -k | stdbuf -o0 grep -P '^KERNEL\[' | stdbuf -o0 awk '{print $2, $3, $4}' | stdbuf -o0 grep -P '^(add|remove)\s/devices/[^/\s]+/[^/\s]+/[^/\s]+/usb\d+[^\s]+/mouse\d+\s\(input\)$' | stdbuf -o0 awk '{print $1}' | while IFS= read -r line;
do
    if [ "$line" = "add" ]
    then
        inc_mouse_count
        touchpad_off
    elif [ "$line" = "remove" ]
    then
        dec_mouse_count
        touchpad_on
    fi
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .