|
楼主 |
发表于 2012-9-17 12:32:56
|
显示全部楼层
在探测到外置鼠标后禁用触摸板
在udev的协助下,可以实现当外置鼠标插入后自动禁用触摸板的功能。可以添加以下udev规则到/etc/udev/rules.d/01-touchpad.rules来实现这一点:
/etc/udev/rules.d/01-touchpad.rules
ACTION=="add", SUBSYSTEM=="input", KERNEL=="mouse[1-9]", ENV{DISPLAY}=":0.0",
ENV{XAUTHORITY}="/home/USERNAME/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", KERNEL=="mouse[1-9]", ENV{DISPLAY}=":0.0",
ENV{XAUTHORITY}="/home/USERNAME/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient TouchpadOff=0"
GDM stores Xauthority files in /var/run/gdm in a randomly-named directory. So udev rules will look like this:
ACTION=="add", KERNEL=="mouse[0-9]", SUBSYSTEM=="input", PROGRAM="/usr/bin/find /var/run/gdm -name *username*", ENV{DISPLAY}=":0.0",
ENV{XAUTHORITY}="$result/database", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", KERNEL=="mouse[0-9]", SUBSYSTEM=="input", PROGRAM="/usr/bin/find /var/run/gdm -name *username*", ENV{DISPLAY}=":0.0",
ENV{XAUTHORITY}="$result/database", RUN+="/usr/bin/synclient TouchpadOff=0"
Note: udev rules must be a single line each, so format accordingly. |
|