zoukankan      html  css  js  c++  java
  • Lxde添加触摸板双击功能、防误触

    前言

    本文链接:https://www.cnblogs.com/hellxz/p/linux_touchpad_settings.html

    这时简单记录一下最近两天折腾Lxde的触摸板功能的设置,留待日后查阅

    本文主要记录一下APT系Linux开启Lxde触摸板双击功能,以及一些关于触摸板防误触方面的设置

    PS: Arch Linux可以直接参考官方wiki

    解决Lxde没有双击功能

    安装驱动包

    sudo apt-get install xserver-xorg-input-synaptics
    

    复制 /usr/share/X11/xorg.conf.d/etc/X11

    sudo cp -R /usr/share/X11/xorg.conf.d /etc/X11/.
    cd /etc/X11/xorg.conf.d
    sudo vim 10-edev.conf #添加edev.conf配置文件,添加自定义配置
    

    新建/usr/share/X11/xorg.conf.d/10-edev.conf

    sudo vim /usr/share/X11/xorg.conf.d/10-edev.conf #添加edev.conf配置文件,添加自定义配置
    

    文件内容如下:

    # To overwrite 70-synaptics.conf default configuration.
    # The Options are useful for diy
    Section "InputClass"  
            Identifier "evdev touchpad catchall"  
            MatchIsTouchpad "on"  
            MatchDevicePath "/dev/input/event*"  
            Driver "synaptics"  
            Option "TapButton1" "1"
            Option "TapButton2" "2"
            Option "TapButton3" "3"
    EndSection
    
    # if touchpad has duplicates, will ignore operation what you have done with touchpad.
    Section "InputClass"
            Identifier "touchpad ignore duplicates"
            MatchIsTouchpad "on"
            MatchOS "Linux"
            MatchDevicePath "/dev/input/mouse*"
            Option "Ignore" "on"
    EndSection
    

    这里开启单击、双击、三指的操作功能,如果不想再使用某一功能,可以设置其值为0或移除此Option

    重启系统

    重启系统后,我们会发现双指操作可以正常使用了,但是我发现打字的时候,大拇指会碰到掌托,鼠标乱跑,基本没法正常打字,这样也是不合需要的。所有有了下边的打字等场景禁用触摸板的记录

    打字时禁用触摸板

    这里有三种方案,其一是开启手掌探测,其二是打字时禁用触摸板,其三是直接禁用触摸板(提供切换脚本)

    查看当前触摸板设置可以参考synclient -l

    开启手掌探测(Palm Detect)

    以下为测试数据,可以使用如下参数在本次会话中测试,如果一切正常且满足需要,可以添加到自启脚本中

    synclient PalmDetect=1 #开启手掌探测
    synclient PalmMinWidth=8 # 手掌最小宽度
    synclient PalmMinZ=100 #手掌用力最小力度(z坐标轴方向)
    

    以上的PalmMinWidthPalmMinZ的数值可以通过evtest软件进行测试,使用方法如下图

    最后我们得到的参数,也可以添加到/usr/share/X11/xorg.conf.d/10-edev.conf中,接续在Option下方

    例如刚才的配置应写为:

    Option "PalmDetect" "1"
    Option "PalmMinWidth" "8"
    Option "PalmMinZ" "100"
    

    打字时禁用触摸板

    syndaemon -i 2 -d  #2s是暂停时间,更多详情参考syndaemon -h
    

    可以添加到自启(auto_start)中,禁用时间可以按需调整,如果不写-m指定毫秒数默认200ms,-i指定秒数,默认2s

    禁用触摸板

    实现思路是通过脚本去切换当前禁用触摸板的状态

    创建shell脚本

    sudo vim /usr/local/bin/touchpad_toggle.sh 
    

    内容如下:

    #!/bin/bash
    
    ts=`synclient -l|grep TouchpadOff`
    ts=${ts#*= }
    
    if [ "$ts" == 0 ]; then
        synclient TouchpadOff=1
    else
        synclient TouchpadOff=0
    fi
    

    当然脚本还可以简写为:

    #!/bin/bash
    synclient TouchpadOff=$(synclient -l | grep -c 'TouchpadOff.*=.*0')
    

    引用文章:

    Arch Linux Wiki

    Ubuntu Wiki

    Linux公社

  • 相关阅读:
    字符链接
    成绩统计
    看不懂的代码
    新的开始
    appserv 求指教php运行环境
    指针 数组 复制
    HTML 标题居中 小小积累
    用指针 数组连接
    [导入]Hibernate+Spring+Struts2+ExtJS开发CRUD功能
    [导入]Hibernate+Spring+Struts2+ExtJS开发CRUD功能
  • 原文地址:https://www.cnblogs.com/hellxz/p/linux_touchpad_settings.html
Copyright © 2011-2022 走看看