我最近在我的笔记本电脑上安装了 Ubuntu(及其衍生产品 Xubuntu 和 Kubuntu)。
我的电脑上既有触摸板,也有指点杆。在 Windows 中,当我使用指点杆时,触摸板会被禁用。
有什么方法可以在 Linux 中重新创建这个吗?
答案1
我通过 Google 搜索了无数个针对此问题的修复方法,最终我想到以下适合我的系统的方案:
#!/bin/bash
#
#Change /dev/input/event13 to your trackstick event
cat /dev/input/event13 > /tmp/mousemove &
#initialize counter to prevent garbage file from growing
i="0";
while true ; do
i=$[$i+1];
#variables
oldchecksum=${newchecksum};
newchecksum=`md5sum /tmp/mousemove | awk '{print $1}'`
#see if trackpad is already disabled
if [ "$trackpad" = "off" ]; then
#compare previous checksum to current if they're same trackstick is not moving
if [ "$oldchecksum" = "$newchecksum" ]; then
#make sure trackpad is enabled
xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1;
trackpad="on";
fi
else
#compare previous checksum to current if they're different trackstick is moving
if [ "$oldchecksum" != "$newchecksum" ]; then
#disable trackpad
xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0;
trackpad="off";
fi
fi
#check for count to keep poll file smaller
if [ "$i" = "300" ]; then
echo '' > /tmp/mousemove;
i="0";
newchecksum=`md5sum /tmp/mousemove | awk '{print $1}'`
fi
#sleep for 1 second so we don't eat up resources
#if the update speed is not fast enough for you a smaller number such as .75 may be better
sleep 1;
done
由于我在 arch 上运行 fluxbox,因此我在我的~/.fluxbox/apps
我发现的唯一警告是,如果您设法以 root 身份运行 pkill cat(该脚本必须以 root 身份运行才能访问鼠标事件),那么您将终止该脚本;同时,如果您终止该脚本但不终止 cat,它将继续运行,直到您用完空间、运行/tmp
pkill cat 或重新启动系统。
答案2
我有一个简单的技巧(实际上是黑客手段):
xinput set-prop "DLL07B0:01 044E:120B" "Synaptics Finger" 100 1000 100
它的作用是设置错误的压力参数(最小值 > 最大值)和一些荒谬的手指尺寸。
Synaptics Finger
32 bit, 3 values, low, high, press.
Option "FingerLow" "integer"
When finger pressure drops below this value, the driver counts it as a release. Property: "Synaptics Finger"
Option "FingerHigh" "integer"
When finger pressure goes above this value, the driver counts it as a touch. Property: "Synaptics Finger"
因此,当压力 > 1000 且压力 < 100 时,驱动程序也会将其计为一次按压,这在逻辑上是不可能的。