Hi everyone,

I'm running kubuntu 12.04 on my first generation macbook air. It runs great except that the synaptiks touchpad settings are always reset when the laptop resumes from suspend. Running the command "synaptikscfg init" solves the problem and loads the values that I specified.

I would like to run this everything my latop resumes. Reading up on how to do this, it seems that all I need to do is:

1. Include a bash script in the /etc/pm/sleep.d folder that has the following general form:

Code:
#!/bin/sh
case $1 in
suspend)
## COMMANDS THAT YOU WISH TO RUN BEFORE SUSPEND
#COMMAND1
echo "Suspeding ..."
;;
resume)
## COMMANDS THAT YOU WISH TO RUN AFTER RESUME
echo "Resuming ..."
;;
hibernate)
## COMMANDS THAT YOU WISH TO RUN BEFORE HIBERNATE
#COMMAND3
echo "Hibernating ..."
;;
thaw)
## COMMANDS THAT YOU WISH TO RUN AFTER RESUME FROM SUSPEND TO DISK
#COMMAND4
;;
esac
I got this info from here and here.

2. make the script executable

Code:
sudo chmod +x /etc/pm/sleep.d/00_myscript
(note: the naming convention is such that the "pm" utility will run all the scripts in alphabetical order when it suspends, and then in reverse order when the laptop wakes up.)

To run my command, I thought that this script would work:

Code:
#!/bin/sh
case $1 in
suspend)
;;
resume)
COMMAND="synaptikscfg init"
echo "Resuming ..."
echo "This is the command that will be run:"
echo $COMMAND
$COMMAND
;;
hibernate)
;;
thaw)
;;
esac
This does not work. When I look at the log in /var/log/pm-suspend.log, I see this message:
Code:
Running hook /etc/pm/sleep.d/0000_touchpad resume suspend:
Resuming ...
This is the command that will be run:
synaptikscfg init
usage: synaptikscfg [-h] [--version] {init,load,save} ...
synaptikscfg: error: could not connect to X11 display

/etc/pm/sleep.d/0000_touchpad resume suspend: Returned exit code 2.
Why doesn't this work?