Re: [systemd-devel] Wishlist: HandleLidSwitchDocked ... when powered?

2016-07-14 Thread Mantas Mikulėnas
On Thu, Jul 14, 2016 at 2:42 PM, Michael Biebl  wrote:

> 2016-07-14 9:28 GMT+02:00 Mantas Mikulėnas :
> > On Thu, Jul 14, 2016 at 5:47 AM, Kai Hendry 
> wrote:
> >>
> >> Hi there,
> >>
> >> I want my T460s machine to suspend on lid close only when it's not
> >> charging off mains.
> >>
> >> I've looked over
> >> https://www.freedesktop.org/software/systemd/man/logind.conf.html &
> >> https://wiki.archlinux.org/index.php/Power_management and I don't see
> >> how this can be achieved.
> >
> >
> > I usually deal with this by running `systemd-inhibit
> > --what=handle-lid-switch ` to prevent the auto-suspend. If you want
> an
> > automatic method, here's some scripting around UPower or udev:
> > https://github.com/grawity/hacks/blob/master/desktop/upower-ac-hold or
> > https://github.com/grawity/hacks/blob/master/system/ac-wait.c
>
> Would that trigger a suspend once you unplug the machine and there is
> a pending request which was inhibited?


For inhibiting handle-lid-switch, yes – logind always tries to suspend if
the lid is closed currently, not just when reacting to lid events.

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Wishlist: HandleLidSwitchDocked ... when powered?

2016-07-14 Thread Michael Biebl
2016-07-14 9:28 GMT+02:00 Mantas Mikulėnas :
> On Thu, Jul 14, 2016 at 5:47 AM, Kai Hendry  wrote:
>>
>> Hi there,
>>
>> I want my T460s machine to suspend on lid close only when it's not
>> charging off mains.
>>
>> I've looked over
>> https://www.freedesktop.org/software/systemd/man/logind.conf.html &
>> https://wiki.archlinux.org/index.php/Power_management and I don't see
>> how this can be achieved.
>
>
> I usually deal with this by running `systemd-inhibit
> --what=handle-lid-switch ` to prevent the auto-suspend. If you want an
> automatic method, here's some scripting around UPower or udev:
> https://github.com/grawity/hacks/blob/master/desktop/upower-ac-hold or
> https://github.com/grawity/hacks/blob/master/system/ac-wait.c

Would that trigger a suspend once you unplug the machine and there is
a pending request which was inhibited?


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Wishlist: HandleLidSwitchDocked ... when powered?

2016-07-14 Thread Mantas Mikulėnas
On Thu, Jul 14, 2016 at 5:47 AM, Kai Hendry  wrote:

> Hi there,
>
> I want my T460s machine to suspend on lid close only when it's not
> charging off mains.
>
> I've looked over
> https://www.freedesktop.org/software/systemd/man/logind.conf.html &
> https://wiki.archlinux.org/index.php/Power_management and I don't see
> how this can be achieved.
>

I usually deal with this by running `systemd-inhibit
--what=handle-lid-switch ` to prevent the auto-suspend. If you want an
automatic method, here's some scripting around UPower or udev:
https://github.com/grawity/hacks/blob/master/desktop/upower-ac-hold or
https://github.com/grawity/hacks/blob/master/system/ac-wait.c

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel