Deepin 2014 自己控制中心提供了图形方式的打开和关闭触摸板的方法,在快捷键中也有关闭触摸板的按键命令Super + T,但没有相应的打开触摸板的按键命令html
搜索后发现网友提供了解决方案shell
http://www.cnblogs.com/scue/p/3633773.html
bash
sudo gedit /bin/touchpadctrlcode
#!/bin/bash - #=============================================================================== # # FILE: touchpadctrl # # USAGE: ./touchpadctrl # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: linkscue (scue), linkscue@gmail.com # ORGANIZATION: # CREATED: 2014年03月09日 12时57分34秒 CST # REVISION: --- #=============================================================================== # xinput --list ==> 获取TouchPad的id号(个人是11) # xinput --list-props 11 ==> 获取TouchPad的设备状态 # man xinput ==> 获取xinput的使用方法 on(){ #synclient TouchpadOff=0 xinput set-prop 11 'Device Enabled' 1 echo -e "\e[0;36mtouchpad on.\e[0m" # cyan exit } off(){ #synclient TouchpadOff=1 xinput set-prop 11 'Device Enabled' 0 echo -e "\e[0;36mtouchpad off.\e[0m" # cyan exit } usage(){ echo -e "\e[0;31m==> Usage: $(basename $0) [ON/off/toggle].\e[0m" # red exit } getstate(){ echo $(xinput --list-props 11 | grep Enable | awk -F: '{print $2}') } toggle(){ echo -en "\e[0;31m==> toggle: \e[0m" # red case $(getstate) in "0" ) on ;; "1" ) off ;; esac } # detect: help if [[ ${1} != "" ]]; then case ${1} in "-h" | "--help" | "-help" ) usage ;; esac fi if [[ $# == 0 ]]; then # auto swtich if [[ $(lsusb | grep 'Sunplus Innovation Technology') != "" ]]; then off else toggle fi else # manual case ${1} in "of"|"off"|"OFF"|"Off") off ;; "t"|"toggle"|"T"|"Toggle") toggle ;; *) on ;; esac fi
而后,自定义快捷按键“切换触摸板开关”,我用 Super + Shift + T,对应命令touchpadctrl 。这样,咱们就能够用 Super + Shift + T来打开或者关闭触摸板了,不会再有触摸板关闭鼠标不在的时候的尴尬。htm
可是,上面的shell脚本并不完美,由于触摸板设备id号须要预先知道,因此,上面的shell不够通用。固然,咱们能够考虑从 xinput --list | grep "TouchPad" ,再解析字符串来取得id号,但总感受这是 Deepin 本身应该去完善的问题。blog
固然,若是不用上面的shell脚本,本身敲命令,能够字符串
xinput --list | grep "TouchPad" 查到触摸板id号,好比我是 11get
而后 xinput enable 11 开启input
xinput disable 11 关闭 (上面的shell脚本考虑当前开关状态,因此比较复杂,用了查找属性值,设定属性值的方式)it