Hi Pau
pkill does take -USR1 as an option, but it is slightly stealthily mentioned.
-signal
A non-negative decimal number or symbolic signal name specifying
the signal to be sent instead of the default TERM. This option
is valid only when given as the first argument to pkill.
USR1 is a signal. If you read the man page sigaction(2), it has a list
of possible signals. In this case, SIGUSR1 is described as
"user defined signal 1", which some programs use for specific events.
xidle does have support for SIGUSR1:
xidle uses the XScreenSaver(3) extension to receive inactivity events
when a timeout is specified, running a specific program after the elapsed
time. xidle will also run the program if it is sent a SIGUSR1 signal, or
if the pointer sits in a corner of the screen for an amount of time.
Signal and corner locking are always enabled, whether -timeout is
specified or not.
And so when xidle receives the USR1 signal, it immediately triggers the
screensaver program.
So, when apmd receives the "suspend event" it will run the
/etc/apm/suspend script. This script sends the SIGUSR1 signal to the
xidle program. xidle receives the signal, and since it has a special
behaviour for SIGUSR1, it then runs the specified screensaver program
xlock.
Hope this helps!
On 2013 Jun 02 (Sun) at 21:08:13 +0200 (+0200), Pau wrote:
:Hi again,
:
:I am trying to understand what the script does (see below) to lock X
:immediately after suspending.
:
:--------------------------------
:Add an /etc/apm/suspend script (make sure it is executable) with the
:following:
:
:#!/bin/sh
:pkill -USR1 xidle
:
:This script will run as root, when the system suspends.
:--------------------------------
:
:Moreover, in the man page of pkill -USR1 is not listed.
:
:thanks!
:
:Pau
:
:On Wed, Aug 1, 2012 at 11:07 PM, Stuart Henderson <
s...@spacehopper.org> wrote:
:
:>> 1) How can I use suspend in a secure way? I am using X, of course, and
:>> I carry the laptop with me all the time to work in my rucksack. I
:>> usually suspend it to resume work later with all windows open etc. But
:>> I would like to know whether there is a way to tell suspend it should
:>> lock the screen after resuming. Is there such a thing?
:>
:> I'm using the same method phessler suggested.
:>
:_______________________________________________
:Openbsd-newbies mailing list
:
Openbsd...@sfobug.theapt.org
:
http://mailman.theapt.org/listinfo/openbsd-newbies
:
--
Help fight continental drift.
_______________________________________________
Openbsd-newbies mailing list
Openbsd...@sfobug.theapt.org
http://mailman.theapt.org/listinfo/openbsd-newbies