Linux 禁用和启用触摸板


Linux 禁用和启用触摸板:

  1. sudo yum -y install xorg-x11-apps  
  2. xinput list  
  3. xinput list-props "SynPS/2 Synaptics TouchPad" //引号中的名字因设备而异  
  4.   
  5. #禁用  
  6. xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0  
  7.   
  8. #恢复  
  9. xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1  

每次禁用或者启用都敲一堆命令着实不方便,所以将它写成一个可执行脚本,如下:

  1. #!/bin/sh   
  2. # test   
  3. case $1 in  
  4.     0)  
  5.         xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0  
  6.         ;;  
  7.     1)  
  8.         xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1  
  9.         ;;  
  10. esac  

最后 chmod +x enable_touchpad.sh 

禁用触摸板:./enable_touchpad.sh 0 

回复触摸板:./enable_touchpad.sh 1 

相关内容