Author Topic: padoo script - toggle touchpad on/off  (Read 1351 times)

Offline collins601

  • Jr. Member
  • **
  • Posts: 29
padoo script - toggle touchpad on/off
« on: December 01, 2010, 04:41:05 PM »
If you are really tired of having the cursor wander all over while you are typing, perhaps you will like this script. Obviously this presumes that you have a usable pointing device (mouse) or that you don't need the touchpad for a while when you are typing.

Here's what to do:

First verify that you have synclient installed ('which synclient'). Fix that if not installed

From a root terminal session
1. Copy the script to a ...bin directory in your path, eg /usr/local/bin/padoo (or some other name)
2. chmod 755 /usr/local/bin/padoo (or some other name)
3. exit from root mode

'padoo' (turn off if touchpad is on, turn on if touchpad is off). synclient does not require toot permissions.

I always keep a terminal session open, but you may prefer to map this to a hotkey. I'll leave that exercise for you to decide.

Code: [Select]
#!/bin/bash
# toggle Touchpad setting - default is off - cer 12/1/2010
t=`synclient -l | grep Touch`   # returns '  Touchpad = 0|1'
ix=`expr index "$t" "="`        # answer is 1 relative
ix=$(($ix+1))                   # skip over blank
oo=${t:$ix:1}                   # this use is 0 relative
if [ $oo -eq 0 ]; then
        offon=1
        msg=off
elif [ $oo -eq 1 ]; then
        offon=0
        msg=on
else
        offon=1
        msg=off
fi
echo "Turning touchpad $msg"
/usr/bin/synclient Touchpad=$offon


Enjoy,

--
Collins



Offline The Chief

  • Hero Member
  • *****
  • Posts: 2229
Re: padoo script - toggle touchpad on/off
« Reply #1 on: December 02, 2010, 12:33:49 PM »
Nice if you don't have a mouse, but I installed synaptik (from the repo) and it automatically switches when ever I plug the mouse in or out.

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3729
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: padoo script - toggle touchpad on/off
« Reply #2 on: December 02, 2010, 01:24:32 PM »
You can use TouchpadToggle. It's available in our repo, too...

Offline collins601

  • Jr. Member
  • **
  • Posts: 29
Re: padoo script - toggle touchpad on/off
« Reply #3 on: December 03, 2010, 06:15:16 PM »
Nice if you don't have a mouse, but I installed synaptik (from the repo) and it automatically switches when ever I plug the mouse in or out.
Now that's nice to know.

edit:The only package I find is synaptiks, and that would drag in half of kde, so I'll pass on that.
« Last Edit: December 03, 2010, 06:20:42 PM by collins601 »

Offline The Chief

  • Hero Member
  • *****
  • Posts: 2229
Re: padoo script - toggle touchpad on/off
« Reply #4 on: December 04, 2010, 11:47:12 AM »
Nice if you don't have a mouse, but I installed synaptik (from the repo) and it automatically switches when ever I plug the mouse in or out.
Now that's nice to know.

edit:The only package I find is synaptiks, and that would drag in half of kde, so I'll pass on that.
Never thought about it, since I use KDE anyway, but I suppose it is a KDE package. 

Perhaps there is something similar for Gnome...  Try searching for touch pad, or something similar.  Anyway, it works wonderfully. 

I also later discovered the same functionality is built into Windows (Vista, at least) and fixed up my wife's laptop to switch when she plugs in her mouse.

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Offline randrums

  • New Friend
  • *
  • Posts: 1
Re: padoo script - toggle touchpad on/off
« Reply #5 on: April 22, 2011, 02:07:33 PM »
You can use TouchpadToggle. It's available in our repo, too...
Thank you so mUch!! So many distros don't have this feature..and you saved me a lot of time. I looked everywhere. Took one sec and now it works!

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3729
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: padoo script - toggle touchpad on/off
« Reply #6 on: April 22, 2011, 03:35:57 PM »
You can use TouchpadToggle. It's available in our repo, too...
Thank you so mUch!! So many distros don't have this feature..and you saved me a lot of time. I looked everywhere. Took one sec and now it works!

You are welcome... ;)