Hi,
You'll need to touch a file in /var/run, call it s3. Next, you'll need to include in your script that whenever the lid button or Fn+f3 is pressed, that file is touched and then go to suspend. When you wake it up, it should check for the file and clear it, then wake up the desktop.
Here's an example of my suspend script:
Code:
#!/bin/sh
tmpfile=`mktemp` || exit 1
# Create a state file here and check it in /etc/acpi/powerbtn.sh so acpid
# knows that the power button press used to wake the machine shouldn't
# hibernate / shutdown / whatever
touch /var/run/S3
# Change to text mode to attempt to avoid hangs on resume with new
# radeon DRM driver
orig_vt=`fgconsole`
chvt 1
# These always seem to cause problems in whatever sleep mode
#modprobe -r ehci_hcd uhci_hcd ipw2200
modprobe -r ipw2200
# Save video state, go to S3, restore video state
videomode=`vbetool vbemode get`
vbetool vbestate save > $tmpfile
/etc/init.d/hwclock.sh stop
echo -n "mem" > /sys/power/state
/etc/init.d/hwclock.sh start
vbetool post
vbetool vbestate restore < $tmpfile
vbetool vbemode set $videomode
# Change back from text mode
chvt $orig_vt
# Can't load them in parallel with & or nasty things happen
#modprobe uhci_hcd
#modprobe ehci_hcd
modprobe ipw2200
# Give ACPI time to get the machine back up, process thermal events, etc.
sleep 10
# After coming back from S3, the battery/AC power state is often messed up.
# Try to fix it here.
### Fixed by hacking DSDT?
# rmmod battery ac
# modprobe battery
# modprobe ac
rm -f $tmpfile
# starting anacron, otherwise cron jobs can be never restarted
/etc/init.d/anacron start
And an example of my powerbutton script:
Code:
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.
if [ -f /var/run/S3 ]; then
rm -f /var/run/S3
else
/usr/sbin/hibernate
fi
HTH,
Titetanium