xidle was a great suggestion thanks. The below script doesn't work either, and for some reason when running apmd in debug mode nothing gets outputted from what I can tell. For locking the screen before suspend I'll probably just stick with Theo's suggestion and run xlock & zzz, although I would love it to work on lid closer also.

On Tue, 12 Dec 2006, Paul de Weerd wrote:

On Mon, Dec 11, 2006 at 11:13:08PM -0500, James Turner wrote:
| I've read the apmd and xlock man pages and am having trouble getting xlock
| to start after a resume.  I created the file /etc/apm/resume and chmod
| 755.  But for some reason, it doesn't run on resume.  Permissions are
| root/wheel.  On a weird note, when I ran sudo apmd rather then letting
| apmd start on boot xlock worked but it locked as root and not my logged in
| user.  Does anyone have any suggestions on how to get xlock to start on a
| resume.
|
| The contents of /etc/apm/resume are:
| #!/bin/sh
| xlock -mode matrix

From your description, I'd say that xlock can not find the DISPLAY
environment variable (only set within X) to run xlock on. Then, when
you start xlock by hand (probably from within X, thus giving it a
valid DISPLAY to connect to), it runs as root simply because apmd runs
as root.

Try putting xidle in your .xinitrc and have that run xlock. xidle then
runs under your own uid and will spawn an xlock owned by you which you
can then unlock using your own password.

An alternative might be to change your script. I have not tested the
following, so it may or may not work :

        #!/bin/sh
        export DISPLAY=:0.0
        sudo -u <yourusernamehere> /usr/X11R6/bin/xlock -mode matrix

I find this, however, to be ugly and not the way things should be
done. Of course, YMMV.

Cheers,

Paul 'WEiRD' de Weerd

--
++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                http://www.weirdnet.nl/

Reply via email to