|
xlock password on suspend-to-ram problem / not working
Slackware 12.1, stock kernel 2.6.24.5-smp, XOrg server 1.4.0.90.
I am using acpi scripts in /etc/acpi/events and /etc/acpi/actions to send the laptop to suspend-to-ram when closing the lid. Everything is working fine, suspend/resume has been working for a while now.
I am trying to modify the script to lock the screen on suspend, so that I am prompted for a password on resume. The script works fine if I run from command line, both as 'su root' or as myself (regular user). However, it fails to lock the screen when triggered by the lid (but everything else in the script runs fine - i.e. the machine goes to sleep and wakes up).
Any ideas as to what would be causing it? I have tried running xlock in the script as 'sudo -u user_name xlock' and 'su user_name -c xlock' to no avail (user_name being the currently logged in user). If I redirect error output from script to a file - I get: 'xlock: unable to open display'. I have tried placing the xlock line before the actual stand-by point in the script and after - still no change.
Any hints appreciated. Here are my actions and events scripts. Just in case you are wondering, the chvt statements were necessary to move through consoles after resume - otherwise the screen comes back with the lamp switched off:
#This is the 'lid' script, in /etc/acpi/events:
# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.
event=button/lid.*
action=/etc/acpi/actions/s2ram.sh %e
#This is the s2ram.sh script, in /etc/acpi/actions
#!/bin/sh
# Suspend to ram when the lid is closed
# First, let's make sure we're not shutting down or rebooting
if [ ! -e /etc/powerdown ]; then
sync ; sync # Just in case...
echo -n mem > /sys/power/state
chvt 7
chvt 2
xlock
fi
|