linux系统下启用或禁用笔记本电脑触摸板(需要安装xinput),linuxxinput,#!/usr/bin/p
文章由Byrx.net分享于2019-03-23 07:03:51
linux系统下启用或禁用笔记本电脑触摸板(需要安装xinput),linuxxinput,#!/usr/bin/p
#!/usr/bin/pythonimport osimport reout = os.popen("xinput list |grep -i touchpad").readlines()[0];reg = re.compile(r'id=(\\d+)');m = reg.findall(out)id = m[0]out = os.popen("xinput list-props " + id ).readlines()[1];reg =re.compile('Device Enabled \\((\\d+)\\): (\\d+)')m = reg.findall(out)if(m[0][1] == '1'): command = 'xinput set-prop ' + id + ' ' + m[0][0] + ' 0'else: command = 'xinput set-prop ' + id + ' ' + m[0][0] + ' 1'os.system(command)#该片段来自于http://byrx.net
评论关闭