Re: Laptop lid closing script

2012-05-31 Thread Robert Connolly
I am favoring this approach, to use idle events to do apm -C and turn off
the monitor, and run a locking screensaver when the system suspends.

Thanks

On Thu, May 31, 2012 at 12:03 AM, David Coppa  wrote:

> On Thu, May 31, 2012 at 7:37 AM, Jan Stary  wrote:
> > On May 30 20:15:42, Robert Connolly wrote:
> >> Hello.
> >>
> >> Is there any way to configure an ACPI event, such as closing the lid of
> a
> >> laptop, to run a script, like 'apm -C' and screensaver?
> >> apm(8) and sensorsd(8) don't seem to do anything like this.
> >
> > Not exactly hooked to a lid close but to a suspend
> > (which happens on lid close if machdep.lidsuspend=1)
> > - see apm(8) mentioning /etc/apm/suspend.
>
> I have this in my ~/.xinitrc:
>
> xidle -area 1 -delay 10800 -program "/usr/X11R6/bin/xlock -mode blank" &
>
> And then in /etc/apm/suspend:
>
> ---8<---
>
> #!/bin/sh
> pkill -30 -x xidle
>
> ---8<---
>
> Cheers!
> David



Re: Laptop lid closing script

2012-05-31 Thread David Coppa
On Thu, May 31, 2012 at 7:37 AM, Jan Stary  wrote:
> On May 30 20:15:42, Robert Connolly wrote:
>> Hello.
>>
>> Is there any way to configure an ACPI event, such as closing the lid of a
>> laptop, to run a script, like 'apm -C' and screensaver?
>> apm(8) and sensorsd(8) don't seem to do anything like this.
>
> Not exactly hooked to a lid close but to a suspend
> (which happens on lid close if machdep.lidsuspend=1)
> - see apm(8) mentioning /etc/apm/suspend.

I have this in my ~/.xinitrc:

xidle -area 1 -delay 10800 -program "/usr/X11R6/bin/xlock -mode blank" &

And then in /etc/apm/suspend:

---8<---

#!/bin/sh
pkill -30 -x xidle

---8<---

Cheers!
David



Re: Laptop lid closing script

2012-05-30 Thread Jan Stary
On May 31 07:37:18, Jan Stary wrote:
> On May 30 20:15:42, Robert Connolly wrote:
> > Hello.
> > 
> > Is there any way to configure an ACPI event, such as closing the lid of a
> > laptop, to run a script, like 'apm -C' and screensaver?
> > apm(8) and sensorsd(8) don't seem to do anything like this.
> 
> Not exactly hooked to a lid close but to a suspend
> (which happens on lid close if machdep.lidsuspend=1)
> - see apm(8) mentioning /etc/apm/suspend.

That's apmd(8) of course.



Re: Laptop lid closing script

2012-05-30 Thread Jan Stary
On May 30 20:15:42, Robert Connolly wrote:
> Hello.
> 
> Is there any way to configure an ACPI event, such as closing the lid of a
> laptop, to run a script, like 'apm -C' and screensaver?
> apm(8) and sensorsd(8) don't seem to do anything like this.

Not exactly hooked to a lid close but to a suspend
(which happens on lid close if machdep.lidsuspend=1)
- see apm(8) mentioning /etc/apm/suspend.



Re: Laptop lid closing script

2012-05-30 Thread Philip Guenther
On Wed, May 30, 2012 at 8:15 PM, Robert Connolly
 wrote:
> Is there any way to configure an ACPI event, such as closing the lid of a
> laptop, to run a script, like 'apm -C' and screensaver?
>
> apm(8) and sensorsd(8) don't seem to do anything like this.

acpibtn(4) doesn't provide a sensor for the lid status, so there's no
generic support for arbitrary actions on lid close.  The
machdep.lidsuspend sysctl(8) can be set to enable automatic
suspend-on-lid-close, which should work on most ACPI systems.

If your box attaches the aps(4) device, it should provide a lid sensor
there which you can monitor from userspace, but that's thinkpad-only.


Philip Guenther



Laptop lid closing script

2012-05-30 Thread Robert Connolly
Hello.

Is there any way to configure an ACPI event, such as closing the lid of a
laptop, to run a script, like 'apm -C' and screensaver?

apm(8) and sensorsd(8) don't seem to do anything like this.

Thanks
Robert