[talk] apmd issue last night

Isaac (.ike) Levy ike at blackskyresearch.net
Mon Feb 16 11:25:21 EST 2015


On 02/16/15 11:00, Eric Radman wrote:
> On Sun, Feb 15, 2015 at 07:02:00PM -0500, Isaac (.ike) Levy wrote:
>>
>> So for my use, I'm *pretty* sure I want apmd running, so I can get the
>> screen locking behavior I want.
>>
>> Is there a way I can get xlock (or alternatively xscreensaver) to run on
>> suspend, without apmd (and /etc/apm/suspend)?
>
> This is a good question and a surprisingly error-prone task.

No kidding :)

> Mailing
> list archives sometimes recommend xautolock, but even without
> suspend/resume it has not worked _reliably_ for me.  There is a section
> in the man page that suggests that it will run the lock program whenever
> the clock jumps:
>
>   -detectsleep    Instructs xautolock to detect that computer has been
>                   put to sleep.  This is done by detecting that time has
>                   jumped by more than 3 seconds.  When this occurs, the
>                   lock timer is reset and locker program is not launched
>                   even if primary timeout has been reached. This option
>                   is typically used to avoid locker program to be
>                   launched when awaking a laptop computer.
>
> But does xautolock promise to run?
>
>   - Eric

Ahh- Ok- I may install and hack around with xautolock... but I'm trying 
to keep this to tools in the base- so xlock(1) for me for now.  There 
was also some interesting arguements on lists about the subtle security 
virtues of xscreensaver(1) over xlock(1).

For today, here's the setup I arrived at, (a simplification of what I 
had running during the failed presentation fun):

####
Starting xidle(1) in my xinit, I can lock the screen quite easily on 
timeout, and also gave myself a "hot corner" like I had on my Mac:

~/.xinitrc 

--
xidle -sw -area 8 -delay 2 -timeout 300 \
   -program "/usr/X11R6/bin/xlock -mode blank" &

exec ssh-agent startxfce4
--

Next, just make sure apmd is running on boot,
--
/etc/rc.conf.local
apmd_flags="-A"
--

Finally, xidle accepts a USR1 signal to trigger locking, so from 
/etc/apm/suspend:

/etc/apm/suspend
--
#!/bin/sh

pkill -USR1 xidle
--
####

Now, future fun: I prefer to start x from startx, (not the graphical 
login), so I'd love to build up that suspend script so that if no xlock 
is running, it kills any interactive tty processes- so a lid close 
performs the same function weather X is running or not.  That'll be a 
bit more work to get solid... :)  Heck, this should work even if there's 
no grraphical login, via xdm(1) or otherwise.

Best,
.ike




More information about the talk mailing list