Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There are several questions about disabling touchpads on laptops on this site, but none of them seem to quite answer my question.

I want to disable my touchpad (I've done that bit) and keep it disabled after a suspend/resume (I am failing here).

I am running Ubuntu 12.04 on a cheap Chinese laptop.

I have an executable file /home/yannick/bin/notouch which looks like this:

xinput set-prop `xinput list | grep "ImPS/2 Generic" | awk '{print $7}' | sed "s/id=//"` "Device Enabled" 0

The script runs xinput once to get the id number of (what turns out to be) my touchpad, and then runs xinput again to disable the touchpad. I have it in my .bashrc and in other places.

At present, when I suspend and then resume my laptop, the touchpad comes alive again and I really want to stop this happening. So I also have a file

/etc/pm/sleep.d/97disable_touchpad (owned by root, +x) which looks like this:

#!/bin/bash
case "$1" in
    thaw|resume)
        /home/yannick/bin/notouch 2>/tmp/notoucherrors
        ;;
    *)
        ;;
esac
exit $?

And darn it, it doesn't work! Indeed the script does seem to run after a resume, and the content of /tmp/notoucherrors is:

Unable to connect to X server
Unable to connect to X server

Dammit I want my touchpad to stay disabled when I hibernate and resume. How do I make this happen?

Here are two other things I tried and that I couldn't get to work:

1) $synclient TouchpadOff=1

This returns

Couldn't find synaptics properties. No synaptics driver loaded?

2) System Settings -> Mouse and Touchpad. I only have options for mouse there (I would even go so far as to say that ubuntu thinks that my touchpad is a mouse for some reason). In particular there is no option to turn the touchpad off -- all I have is mouse options (general, pointer speed, drag and drop, double-click timeout).

share|improve this question
add comment

2 Answers

I have a partial workaround which will do for now -- I randomly set the DISPLAY variable and hope. Works for now. I also run notouch as my userid (rather than root).

My disable_touchpad script in sleep.d now looks like this:

#!/bin/bash
case "$1" in
    thaw|resume)
        echo "running notouch" >> /tmp/notouchlogger
        export DISPLAY=:0
        su -c - yannick /home/yannick/bin/notouch 2>>/tmp/notoucherrors
        ;;
    *)
        ;;
esac
exit $?

and it seems to work.

share|improve this answer
add comment

With root privileges, try creating the file /etc/pm/sleep.d/0000trackpad.

sudo -i gedit /etc/pm/sleep.d/0000trackpad

enter you password if required past following code in gedit and save file

#!/bin/sh
case "$1" in
    resume)
        DISPLAY=:0.0 su USER -c '/usr/bin/synclient TouchpaOff=0' ;;
esac

log out and back in again

share|improve this answer
add comment

Your Answer

 
discard

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.