Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use synclient touchpadoff=1 to disable touchpad and synclient touchpadoff=0 to enable touchpad.

$synclient | grep TouchpadOff
    TouchpadOff             = 1

I'd like to create script that will toggle this value. Then I will bind to key in OpenBox.

share|improve this question
up vote 6 down vote accepted

How about

if synclient -l | egrep "TouchpadOff.*= *0" ; then 
    synclient touchpadoff=1 ; 
    synclient touchpadoff=0 ; 

Note that there is a third setting, "TouchpadOff = 2", where only tapping is disabled.

Another possibility, a oneliner, but not a very efficient one:

synclient touchpadoff=`{ synclient -l | egrep "TouchpadOff.*= *0" && echo 1 ; } || echo 0`
share|improve this answer
Thx, didn't know about egrep. Btw is it possible to create oneliner? – kravemir Oct 10 '12 at 9:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.