:: Re: [DNG] Disabling touchpad
Top Page
Delete this message
Reply to this message
Author: Steve Litt
Date:  
To: dng
Subject: Re: [DNG] Disabling touchpad
On Sun, 27 Dec 2020 10:20:04 -0500
Hendrik Boom <hendrik@???> wrote:

> My touchpad is absurdly sensitive, and I keep brushing against it by
> accident. I don't feel the touch at all, but the computer sure does.
> It can hapen while I'm typing and suddenly my text edit turns into a
> shell command in a newsly chosen window.
> I suspect even a few beard hairs can activate it.
>
> Now I usually use a wireless mouse on this computer though
> occasionally the mouse fails (usually low battery) an then I do want
> the touchpad.
>
> Is there any way to disable the touchpad normally, but to reactivate
> it easily when the mouse fails?


Yes!

The attached touchtoggle.sh should fulfill your exact needs. Just
associate it with a convenient hotkey.

For convenience I'm also putting it in the body, but use it from the
attachment: I have no idea what email clients do to the characters in
the file:

======================================================
#!/bin/sh

# touchtoggle.sh Copyright (C) 2019 by Steve Litt
# All rights reserved.
# Licensed via the
# Expat license: https://directory.fsf.org/wiki/License:Expat

# FIRST GET DEVICE'S DEVICE ID CONTAINING CASE INSENSITIVE "TOUCHPAD"
devid=`xinput | grep -i touchpad | \
sed -e"s/.*id=//" | sed -e"s/\s.*//"`

# WITH THAT DEVICE ID, FIND EVERYTING ABOUT PROPERTY
# CONTAINING CASE INSENSITIVE "DEVICE ENABLED"
scratchline=`xinput --list-props 11 | \
grep -i "device enabled" | \
sed -e"s/^\s*//" | sed -e"s/\s*$//"`
proptext=`echo $scratchline | sed -e"s/\s*(.*//"`
propid=`echo $scratchline | sed -e"s/.*(//" | sed -e"s/).*//"`
currstate=`echo $scratchline | sed -e"s/.*):\s*//"`

# DIAGNOSTICS, COMMENT OUT WHEN FULLY FUNCTIONAL
echo diagnostic devid      =$devid
echo diagnostic scratchline=$scratchline
echo diagnostic proptext   =$proptext#
echo diagnostic propid     =$propid


# TOGGLE CURRSTATE VARIABLE
echo -n "Current state of $currstate "
if test "$currstate" = "1"; then
    currstate=0
else
    currstate=1
fi
echo has been changed to $currstate.


# IMPLEMENT THE PROPERTY VALUE CHANGE
xinput set-prop $devid $propid $currstate

# UNCOMMENT FOLLOWING LINE IF PROPERTY ID STOPS WORKING
#xinput set-prop $devid "$proptext" $currstate

======================================================

I've had several versions of this shellscript, so please let me know
whether it works for you.

SteveT

Steve Litt
Autumn 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive