Proof of concept script to disable the touchpad while typing
#1
I've just quickly made the following script for python, only tested with python3, on the stock Mate pinebook install.
Not sure if other installs move around the xinput device for the touchpad (else replace the 8 with the right number)

This script disables the touchpad of the pinebook for 0.5 second whenever a key is pressed, any key, including ctrl/shift/alt/mod.  So it's not perfect and cannot be use for shift/ctrl+click very effectively yet. But the script could be modified for that.

Note that if you google for the touchpad problem, you will find a lot of mentions for "syndaemon", which doesn't work (and exits without a message) The "synclient" command however will tell you why, because our touchpad isn't showing up as a touchpad but as an emulated mouse.
Hench this hacky script.

And I've just typed this post without a single problem while the script is running. Figured I share this ASAP, as the very sensitive touch pad is at the top of the list of things that people find annoying.

Code:
import threading
import time
import os

class TouchpadHack:
    def __init__(self):
        self.__disabled = False
        self.__condition = threading.Condition()
        self.__disabled_until_time = time.monotonic()
        
        threading.Thread(target=self.timeoutThread).start()
    
    def timeoutThread(self):
        while True:
            with self.__condition:
                self.__condition.wait()
            os.system("xinput disable 8")
            print("disable")
            while time.monotonic() < self.__disabled_until_time:
                time.sleep(self.__disabled_until_time - time.monotonic())
            os.system("xinput enable 8")
            print("enable")

    def inputReadThread(self):
        f = open("/dev/input/event2", "rb")
        while True:
            # We read events here from the keyboard and then just ignore them.
            # The only thing we care about is that an event happens.
            event = f.read(100)
            with self.__condition:
                self.__condition.notify()
                self.__disabled_until_time = time.monotonic() + 0.5

TouchpadHack().inputReadThread()


Messages In This Thread
Proof of concept script to disable the touchpad while typing - by daid - 08-13-2017, 02:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to enable touchpad natural scrolling? plumlis 3 6,488 07-19-2020, 02:46 PM
Last Post: Martin Gruber
  Disable touchpad tap to click? colin.faulkingham 25 36,131 04-27-2020, 07:31 PM
Last Post: ab1jx
Sad touchpad edges scrolling kurai021 11 13,799 07-09-2017, 05:56 PM
Last Post: Luke

Forum Jump:


Users browsing this thread: 1 Guest(s)