Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

potyl (8582)

potyl
  (email not shown publicly)
Jabber: emmanuel.rodriguez@gmail.com

Journal of potyl (8582)

Monday October 05, 2009
01:50 AM

Enable/Disable touch pad

[ #39711 ]

I use a MacBook as my main computer. I work on that laptop and do all my random hacking on it as well.

What might seem odd is that I run Linux on that hardware. Installing Linux there and getting it to work properly requires a lot of work and sacrifice: the web cam doesn't work and the OS sees a single CPU. Otherwise all is working fine and if the proper software (fan control) is installed the laptop won't overheat. I can even play an OpenGL game in Perl!

One thing that I have noticed since I work on this MacBook is how clumsy I can be while typing. I would always hit the huge track pad and destroy my own work! OS X has a feature to disable the touch pad when a mouse is plugged and I would like to have the same feature in Linux. I think that the next version of Gnome will have this feature, but I want something like that now.

Luckily in Linux we have all the tools to implement this. What's missing is something to put all the pieces together, something like a glue language. So I wrote a small Perl script that can toggle the touch pad for me: toggle-touchpad. I binded the script to a keyboard combination through my window's manager keybindings and I can now enable/disable the touch pad at will!

This script will only work if the synaptic touch pad is configured to use shared memory. This means that the following option has to be set in the synaptic's driver section of your X11 configuration file:

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        Option          "HorizScrollDelta"      "0"

        # Use shared memory
        SHMConfig       "On"
EndSection

Once the driver is configured to use shared memory the touch pad settings can be modified at runtime without needing to restart the X server. The program synclient can be used for playing around with the touch pad's settings. Once that done disabling the touch pad is as simple as doing:

synclient touchpadoff=1

Voila!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • When typing touchfreeze turns off the touchpad, unclutter hides the pointer.
  • I don't know about MacBooks, but my MacBook Pro's iSight works just fine if I load the right driver. See this thread on how to get it to work with Ubuntu: http://ubuntuforums.org/showthread.php?t=225621 [ubuntuforums.org].

    Seeing one CPU is most likely a result of using the wrong kernel. Look for an SMP version of the kernel to take advantage of the second core (the default Ubuntu Kernel works just fine for me).

    You may want to look into the options on syndaemon, it can disable the touchpad while you are typing: https://help. [ubuntu.com]

    • I don't know about MacBooks, but my MacBook Pro's iSight works just fine if I load the right driver.

      The latest version of the MabBook Pro has no problem with the video camera. But under the latest MacbBook it doesn't work.

      Seeing one CPU is most likely a result of using the wrong kernel.

      The missing CPU is not related to the kernel type. It's a well known kernel bug which causes the MacBook not to boot.

      As surprising as it might seem the latest MacBookPro works better under Linux than the latest MacBook. A colleague has the new MabBoookPro and installing Ubuntu there was quite easy, when I tried to install the same OS in the MacBook I was set for a nice ride!

      You may want to look into the options on syndaemon.

      Definitely!