Linux Mint – Disable Touchpad on Mouse Connect

Hello my dear readers,

I was struggling with the Touchpad in my laptop as it’s very sensitive and activates even with the softest touch.

Being a shell script enthusiast made me think that some simple, efficient code could for sure make this work. So I did some Googling and found some code that may come handy for this.

The original post by red-lichtie can be found on the LM forums by following this LINK

But for the sake of simplicity, let’s put the code here.

A script: /usr/local/bin/ (with perms 766 so that only root can call it)

sleep 1
tpID=$(xinput list | grep -i $TOUCHPAD_NAME | awk '{ print $6 }' | sed 's/id=//')
case "$1" in
   /usr/bin/xinput --enable $tpID
   /usr/bin/xinput --disable $tpID

And a rule set: /etc/udev/rules.d/99-touchpad-autotoggle.rules

SUBSYSTEM!="usb", GOTO="touchpad-autotoggle_end"
ACTION=="add",    ATTR{bInterfaceClass}="03", ATTR{bInterfaceSubClass}="01", ATTR{bInterfaceProtocol}="02", RUN+="/usr/local/bin/ off"
ACTION=="remove", ATTR{bInterfaceClass}="03", ATTR{bInterfaceSubClass}="01", ATTR{bInterfaceProtocol}="02", RUN+="/usr/local/bin/ on"

These are some awesome 19 lines that solve a requirement that is well-known in the Linux community. Even more outstanding is the fact that while using the very core of the Linux functionalities as SH, udev and xinput; this functionality will work for any Linux distro that doesn’t come with this option already.

For me on Linux Mint


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s