Otherwise, calculate when you have to check again and repeat this step.įor example: A key was pressed at time 0ms. If after that time no additional key events have occured, enable the touchpad.
#How to enable touchpad while typing how to
As answers, I can accept suggestions for changing this very python script, or maybe guidance on how to solve this with a bash script, or really any idea that guide me to solve this (thinking outside the box is welcome also). I don't need to solve this problem using python necessarily, but that's the only way I was able to address it on the first place. My goal precisely is to able to deactivate the touchpad while typing and get the touchpad activated back around 300ms after I stop typing. Setting "time.sleep(0.5)" to a smaller number seems like an obvious choice, but setting it to 0.05 for example, only seems to make the script more cpu-hungry, but it makes no visible change on the delay between me stop typing and the touchpad getting reactivated. The only problem is that it takes about 1s for the touchpad to get enabled back, which is kinda long, and I haven't found no way to make this delay smaller. As soon as I start typing the touchpad is disabled. Subprocess.call('xinput set-prop '+touch+' 142 0', shell=True) P = subprocess.Popen('xinput test '+keyboard, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
![how to enable touchpad while typing how to enable touchpad while typing](https://i.stack.imgur.com/fiaSp.png)
Subprocess.call('xinput set-prop '+touch+' 142 1', shell=True) Keyboard = os.popen("xinput list -id-only 'keyboard:SINO WEALTH USB KEYBOARD'").read()
![how to enable touchpad while typing how to enable touchpad while typing](https://i.stack.imgur.com/k8kMb.png)
Touch = os.popen("xinput list -id-only 'pointer:SINO WEALTH USB KEYBOARD'").read() Reading through lots of related questions here and elsewhere, I've managed to adapt this python script to my problem. Also Ubuntu doesn't recognize it as a touchpad, so I can't use the Ubuntu embedded solution for disabling the touchpad while typing. The libinput property "Disable-w-typing" is not avaliabe (it has "n/a" as the value on "libinput list-devices"). Long story short: I have a keyboard with a touchpad which is recognized as a "pointer" on xinput, and has "keyboard pointer" capabilities in libinput (in opposition to being recognized as a touchpad).