[xubuntu-users] toggle touchpad ON/OFF

Steve Litt slitt at troubleshooters.com
Tue Mar 29 19:09:29 UTC 2016

On Wed, 30 Mar 2016 02:22:04 +0900
Thomas <nyuwa at hb.tp1.jp> wrote:

> On 2016年03月28日 07:49, Steve Litt wrote:
> > On Sun, 27 Mar 2016 19:06:57 +0900
> > Thomas <nyuwa at hb.tp1.jp> wrote:
> >
> >
> > #!/bin/bash
> >
> > curstate=`synclient | grep -i TouchpadOff | sed -e"s/.*= //"`
> >
> > if test "$curstate" = "1"; then
> >
> > synclient TouchpadOff=0
> >
> > else
> >
> > synclient TouchpadOff=1
> >
> > fi
> >
> >
> > Copy those lines into a file, located on the executable path,
> > called* "touchtoggle". Chmod a+x touchtoggle.
> >
> > Now, using your window manager, assign a hotkey to run touchtoggle.
> > Once you've done that, hitting the hotkey switches the touchpad to
> > "off". Hitting the hotkey once more switches it back to "on", over
> > and over, forever and ever.  
> I am afraid, I am still not able to make it work.
> * Created a file with above lines
> - the "Chmod a+x touchtoggle" did work only with a lower case c in
> chmod
> * After some googling I finally found out how to copy that file into 
> /usr/bin/
> * File properties -> Permissions -> allow this file to run as a
> program -> However, right clicking on the file does not show the item
> "execute" -> In the past I tried to create a shortcut key to toggle
> the touchpad (which did not work):
> * "/usr/bin/touch" -> Crtl + Win + P
> -> Changed this command now to "/usr/bin/touchtoggle"  
> Still .. nothing happens.
> I assume there is very simple trick that I am just not seeing.

First, congrats for getting deeper into Linux. I know it seemed like a
trudge, but the knowledge you gained of how to proceed when confronted
with a brick wall will serve you well forever.

What you have left now is just some troubleshooting. Start by seeing if
the command works without a hotkey, by typing the word touchtoggle
followed by the Enter key at the command prompt, and seeing whether it
turns on and off the touchpad. Make sure the touchtoggle file is
permissioned as executable by all. If it's permissioned executable for
all and still doesn't toggle the touchpad state, you need to start
experimenting with the individual "synclient TouchpadOff=0" and
"synclient TouchpadOff=1" commands at the command prompt. If they don't
work at the command prompt, investigate the error messages. On all of
these, if they don't work when logged in as yourself, try them again
logged in as root, and see if it makes a difference.

If the touchtoggle command DOES toggle the state of the touchpad but
the hotkey doesn't work, you have a hotkey problem. Start by assigning
that same hotkey to running xterm or some other terminal emulator you
have installed. If it doesn't do that, you need to use some other
system to connect a hotkey to a runnable command. Also, try a different
hotkey: Perhaps the one you're using is pre-empted by something else.

Keep narrowing the root cause scope of the problem by performing
diagnostic tests that rule out large chunks (ideally but not
necessarily half) of the remaining root cause scope, until you find the
root cause, then fix the root cause.

This sounds like a real pain in the posterior, but the more you do this
kind of troubleshooting, the more proficient you get, until, one day in
the near future, people start saying "Go to Thomas, he can fix


Steve Litt 
March 2016 featured book: Quit Joblessness: Start Your Own Business

More information about the xubuntu-users mailing list