-
设备:小米air12.5
-
环境:Deepin Linux 15.9
-
问题:触摸板快捷键在linux系统下失效,时有误触。
-
其他设备尚未做测试,料想应该是通用。
解决过程1:
-
使用xinput命令找到设备名称和id,通过xinput enable/disable id来实现触摸板的开启和禁用。
-
如果是deepin 需要先安装一下xinput命令
-
如果绑定快捷键需要2个按键。
-
问题初步解决但未达到预期效果
-
在1使用的是比较偷懒的方式,另一种 xinput set-prop "Device Enabled" 0/1
执行情况如下图,这里看到触摸板的id=9
![](https://img.haomeiwen.com/i7683218/452f678dfc2d724d.png)
如果是Deepin Linux需要先下载xinput命令,Ubuntu不需要
sudo apt-get install xinput
解决过程2:
-
创建一个shell文件,使其拥有可执行权限
-
在shell文件中一步步查找,找到触摸板设备的id与状态。如果是1则设置为0,如果不是则设置为1
-
将shell文件与快捷键进行绑定,只需要一个按键
touch turn_touchPad.sh#创建shell文件
chmod +x turn_touchPad.sh #使shell文件具有可执行权限
./turn_touchPad.sh #执行shell文件,绑定时需要
#!/bin/bash
touchPadInfo=$(xinput | grep 设备名字)
touchPadInfo2=$(echo $touchPadInfo | sed 's/ /\n/g' |grep "id")
deviceId=${touchPadInfo2#"id="}
var1=$(xinput list-props $deviceId | grep "Device Enabled")
var2=${var1%?}
deviceStatus=${var1##$var2}
if [ $deviceStatus -eq 1 ];then
xinput set-prop $deviceId "Device Enabled" 0
else
xinput set-prop $deviceId "Device Enabled" 1
fi
![](https://img.haomeiwen.com/i7683218/8d1063029769465e.png)
网友评论