ubuntu 关闭/打开触摸板功能

来源:互联网 发布:java方法的特征签名 编辑:程序博客网 时间:2024/05/22 16:45

 1、先通过 xinput 查看一下有哪些输入设备,找出触摸板的名称,执行 xinput list  得出结果大致如下:

 

 

⎡ Virtual core pointer                     id=2[master pointer  (3)]

⎜   ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]

⎜   ↳ Logitech USB Receiver                    id=11 [slave  pointer  (2)]

⎜   ↳ Logitech USB Receiver                    id=12 [slave  pointer  (2)]

⎜   ↳ SynPS/2 Synaptics TouchPad              id=14 [slave  pointer  (2)]

⎣ Virtual core keyboard                    id=3[master keyboard (2)]

    ↳ Virtual core XTEST keyboard              id=5 [slave  keyboard (3)]

    ↳ Power Button                             id=6 [slave  keyboard (3)]

    ↳ Video Bus                                id=7 [slave  keyboard (3)]


从上面结果,可以看出触摸板名称为"SynPS/2 Synaptics TouchPad",id为14。
   
   2、再通过 xinput list-props 14 查看触摸板所有相关属性,结果大致如下:
Device 'SynPS/2 Synaptics TouchPad':
Device Enabled (132):0
Coordinate Transformation Matrix (134):1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (260):1
Device Accel Constant Deceleration (261):2.500000
Device Accel Adaptive Deceleration (262):1.000000
Device Accel Velocity Scaling (263):12.500000
Synaptics Edges (285):1768, 5406, 1640, 4498
Synaptics Finger (286):25, 30, 256
Synaptics Tap Time (287):180
Synaptics Tap Move (288):236
Synaptics Tap Durations (289):180, 180, 100
其中“Device Enabled (132)就是用来控制是否开启的,值 0:代表禁用,1:代表启用。
     
    3、然后再通过 xinput set-prop 更改其属性值,如: xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Device Enabled' 0,但如果每次都需要敲这么长的命令肯定是不可能的,我们可以通过在 ~/.bashrc文件中添加命令别名,如:     
        alias tpOff="xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Device Enabled' 0"
        alias tpOn="xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Device Enabled' 1"
成功添加之后,再执行 source ~/.bashrc ,就可以通过 tpOff 、tpOn灵活设置了
原创粉丝点击