I have set up my laptop (running Dapper Ubuntu) so that a simple press of ctrl+F5 toggles the touchpad on and off (so I don't knock it whilst typing, and because I use a mouse much of the time). This was done according to the guide found
HERE
I was however thinking about taking this one step further by running a script that worked along these lines:
Code:
#!/bin/bash
OUTPUT=$(lsusb)
if [ "OUTPUT" = "*Logic3 / SpectraVideo plc*" ]; then #this is what my mouse reads as
synclient touchpadoff=1 #typing this in turns the touchpad off
wait 2 #is 2 seconds a good time frame?
go to start of script
else synclient touchpadoff=0 #turns the touchpad on
wait 2
go to start of script
This script is simply supposed to check the output of "lsusb" every couple of seconds to see if my mouse is plugged in, and if it is - disable the touchpad, and then reenable the touchpad when I unplug the mouse.
Problem number 1 is that I obviously don't know how to do loops (I'm exceptionally new to bash scripting), and all the google action I have found so far has been over my head.
Additonally, I don't know if this would take up too many system resources, though my initial reaction is that it wouldn't.
The input doesn't mind if the command "turn off" is entered when the touchpad is already turned off, though it would of course be nice not to keep sending the command every 2 seconds if it's not needed.