根据外接鼠标自动屏蔽笔记本触摸板的办法
发表于 : 2011-01-17 15:58
A
可以使用我截图中标明的工具和选项来实现这个功能:
B
另外一个办法就是用udev规则
参考:
https://wiki.archlinux.org/index.php/To ... 8.E6.9D.BF
C
完全一点的解决方案:
把这个脚本保存到/usr/local/bin下面,脚本名字可以写成:synapticsautooff,当然其他的也行,不过你需要改下面脚本对应的内容。
需要安装 inotify-tools
把这个脚本加入到自动启动里面,这个方法比较纯粹,如果上面的工具解决不了这个问题可以用这个脚本
可以使用我截图中标明的工具和选项来实现这个功能:
B
另外一个办法就是用udev规则
代码: 全选
ACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", RUN+="/usr/bin/synclient TouchpadOff=0"
https://wiki.archlinux.org/index.php/To ... 8.E6.9D.BF
C
完全一点的解决方案:
把这个脚本保存到/usr/local/bin下面,脚本名字可以写成:synapticsautooff,当然其他的也行,不过你需要改下面脚本对应的内容。
需要安装 inotify-tools
代码: 全选
#!/bin/bash
#
# Script: synapticsautooff
#
# Description:
# This script monitors /dev for device changes. If something changed, then check /proc/bus/usb/devices
# to find out the appearance of a mouse. Then turn touchpad off, or turn touchpad on.
#
# Requirement:
# inotify-tools
trap "" SIGTERM # For the next command
killall synapticsautooff
trap - SIGTERM # Reset to original disposition
###########
# Constants
devfile=/proc/bus/usb/devices
synclient=/usr/bin/synclient
####################
# Check requirements
# Check device list file
if [ ! -e $devfile ]
then
echo "Can not find $devfile"
exit 0
fi
# Check inotifywait
notify=`whereis inotifywait -b | awk '{ print $2 }'`
if [ ${#notify} -eq 0 ]
then
echo "This script needs inotify-tools"
exit 0
fi
# Check synclient
synclient=`whereis synclient -b | awk '{ print $2 }'`
if [ ${#synclient} -eq 0 ]
then
echo "This script needs synaptics"
exit 0
fi
#################
# Check USB mouse
CheckMouse ()
{
grep -i "mouse" $devfile > /dev/null
if [ $? -eq 0 ]
then
# Has usb mouse, so turn off touchpad
$synclient TouchpadOff=1
else
grep -i "USB Receiver" $devfile > /dev/null
if [ $? -eq 0 ]
then
$synclient TouchpadOff=1
else
# No usb mouse, so turn on touchpad
$synclient TouchpadOff=0
fi
fi
}
CheckMouse # Check at first
##############
# Waiting Loop
while true
do
$notify -q -e create -e delete /dev/
# Device changes
CheckMouse
done
exit 0