I am running 11.04 on an Asus UL30. I am trying to run a script to fix my synclient settings (which are lost during resume). I have written the following script in /etc/pm/sleep.d/10_touchpad:


#change synclient settings on resume

case "$1" in 


        sleep 15 && synclient TapButton2=2 TapButton3=3 ;;

/var/log/pm-suspend shows the following:

/etc/pm/sleep.d/10_grub-common suspend suspend: success. Running hook /etc/pm/sleep.d/10_touchpad suspend suspend: /etc/pm/sleep.d/10_unattended-upgrades-hibernate resume suspend: success. Running hook /etc/pm/sleep.d/10_touchpad resume suspend: Failed to connect to X Server.

/etc/pm/sleep.d/10_touchpad resume suspend: success. Running hook /etc/pm/sleep.d/10_grub-common

Not really sure why the synclient changes aren't being chnaged by this script on resume. Would appreciate any insight....

  • 1
    It's not working because the script runs as root, and also because synclient requires access to your X session. I don't have a solution for you.
    – Geoff
    Jan 26, 2012 at 23:05
  • Found an answer.
    – Geoff
    Feb 1, 2012 at 15:33

1 Answer 1


Direct answer

In order to achieve your goal (of running an X-session dependent user-space script when your machine resumes) you must:

  1. run the script as the appropriate user; and
  2. ensure the DISPLAY variable is set.

I would move the line sleep 15 && synclient TapButton2=2 TapButton3=3 to a separate file say /usr/local/sbin/setupTouchpad.sh and replace the line with:

   export DISPLAY=:0
   su -c - <yourusername> /usr/local/sbin/setupTouchpad.sh

Where <yourusername> should be replaced. Note that it is still a good idea to have some sleep time to be sure the system is awake before running the code. Also, be sure to chmod +x that setupTouchpad.sh script.

A better way

The problem with the above is that you have to hard-code your username (or use some hackish way to discover which user is logged in and has the active X session). It's better to set system-wide touchpad settings for X.

These options may be set in /usr/share/X11/xorg.conf.d/

For me, the correct file to edit is 50-synaptics.conf here I've set options, here's a portion of that file:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"

        Option          "TapButton2"              "2"
        Option          "TapButton3"              "3"

        # Etc...

As you may already be aware, to see valid options simply run synclient.

Note you must restart X for these changes to take effect. To do so in Ubuntu, for example, you can run sudo /etc/init.d/lightdm restart

To preview your changes you may try running the following line (or some variant). Remove | bash from the end to see the commands it's issuing.

cat /usr/share/X11/xorg.conf.d/50-synaptics.conf | grep Option | grep -v "^\#" | awk '{print "synclient " $2 "=" $3}' | sed 's/\"//g' | bash

If you Google around for touchpad settings synaptics xorg.conf.d you'll find a few good overviews of options, also.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .