Step 2

In this next part we will create a script to toggle the touchpad. There are a couple of ways to write the scripts to toggle the touchpad on and off. The first method uses Python, the second method uses a more simple bash script. Choose the one you like the most.

Step 2a

Next we will create 3 files - a bash script to turn the touchpad off, one to turn it on, and a python script to use a single key combination for both. At a terminal, cd to /usr/local/bin and make a new file:

then click apply & save & exit (change the script name in the 'Action' field if you used the other method.)

Now that that is done, restart xbindkeys:

xbindkeys

You may need to restart X.

Remember that each time you restart X, you will need to run xbindkeys again in order for the shortcut to work. Go to System>Preferences>Sessions>Startup Programs> click add type xbindkeys then click ok.

Bash Script

Instead of using the 3 scripts above, you can achieve the same thing with a single bash script:

The following sh/bash shell script is a refinement of the script above. It eliminates use of the 'export' command in favor of a simple variable assignment and includes some comments and prints a message confirming the action taken.

Copy and paste the script into the open text doccument, then save your document and close the text editor.

In your open terminal enter:

chmod +x touch_toggle.sh

to make your script executable.

Expose your launcher and click the; System Settings icon, in the pop up window select; Keyboard, and then the; Shortcuts tab. From this tab select; Custom Shortcuts, and then the "+" icon. In the pop up enter a name for your shortcut (touch_toggle works nicely), and then in the command box enter:

./touch_toggle.sh

Then click; apply, and you should now have a new entry listed as disabled. Click on the "disabled" in your new entry, then press the keys you wish to toggle your touchpad with, this should set your desired key combination to run the touchpad toggle script.