[Jan 14] KDE Neon (20190113-1500) - Pinebook1080P / Pinebook |[Jan 14] Q4OS (2.7-r1) - Pinebook1080P / Pinebook | [Dec 07] DietPi(v6.18) - Pinebook / Manjaro KDE (preview3) / Manjaro LXQT (preview3) - Pinebook |[Dec 06] Armbian Debian Stretch (5.67) / Armbian Ubuntu 18.04 Bionic Desktop (5.67) - RockPro64 |[Dec 05] DietPi(v6.18) - 1080P Pinebook

Project Inspiration | Get Started | IRC Logs | Forum Rules/Policy


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()
Reply


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 2 160 12-08-2018, 10:35 AM
Last Post: Surehand53
  Disable touchpad tap to click? colin.faulkingham 15 1,593 08-04-2017, 09:36 PM
Last Post: MarkHaysHarris777
Sad touchpad edges scrolling kurai021 11 1,004 07-09-2017, 05:56 PM
Last Post: Luke

Forum Jump:


Users browsing this thread: 1 Guest(s)