Automatically Disable the Touchpad when a USB Mouse is plugged in under Linux with udev v. 0.2

I wanted to do it, came across this bug at Ubuntu.
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/116919

I made a generic version inspired by the appletouch howto and by the script
/usr/share/doc/xserver-xorg-input-synaptics/script/usbmouse
from xserver-xorg-input-synaptics

udev rule: /etc/udev/rules.d/85-synaptics.rules

# automaticly disable touchpad when usb mouse present
# (c) 2008 D. Jansen <>
# published under the GNU GPL 3.0, other licenses on request
SUBSYSTEM=="usb", SYSFS{product}=="*Mouse*"
ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/home/djtm/scripts/touchpad-udev"
ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/home/djtm/scripts/touchpad-udev"


and the script /home/djtm/scripts/touchpad-udev

#!/bin/bash
# automaticly disable touchpad when usb mouse present
# (c) 2008 D. Jansen <>
# published under the GNU GPL 3.0, other licenses on request

if [ "$(grep -e Mouse /proc/bus/input/devices)" ]; then
xinput set-int-prop "Synaptics Touchpad" "Synaptics Off" 8 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Off" 8 1
#synclient TouchpadOff=1
else
xinput set-int-prop "Synaptics Touchpad" "Synaptics Off" 8 0
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Off" 8 0
#synclient TouchpadOff=0
fi
The new version no longer requires -- Option "SHMConfig" "On" -- in xorg.conf

1 comment:

  1. Hi !
    I'm looking for this functionality for a while.. I had a script, but it doesn't work since ubuntu 8.10...
    However, I experience this with your script : when I plug an usb mouse, the touchpad is activated, and is deactivated when I remove the mouse... so I tried to change the TouchpadOff values... but there, the touchpad never comes off... I think it's small thing to make it work, but can't put a finger on it... could you please help ? (I'm under jaunty now)
    Thanks in advance
    d [dot] wendlinger [at] gmail [dot] com

    ReplyDelete

I appreciate comments. And I do read them.