<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 14, 2016 at 2:42 PM, Michael Biebl <span dir="ltr"><<a href="mailto:mbiebl@gmail.com" target="_blank">mbiebl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2016-07-14 9:28 GMT+02:00 Mantas Mikulėnas <<a href="mailto:grawity@gmail.com">grawity@gmail.com</a>>:<br>
> On Thu, Jul 14, 2016 at 5:47 AM, Kai Hendry <<a href="mailto:hendry@webconverger.com">hendry@webconverger.com</a>> wrote:<br>
>><br>
>> Hi there,<br>
>><br>
>> I want my T460s machine to suspend on lid close only when it's not<br>
>> charging off mains.<br>
>><br>
>> I've looked over<br>
>> <a href="https://www.freedesktop.org/software/systemd/man/logind.conf.html" rel="noreferrer" target="_blank">https://www.freedesktop.org/software/systemd/man/logind.conf.html</a> &<br>
>> <a href="https://wiki.archlinux.org/index.php/Power_management" rel="noreferrer" target="_blank">https://wiki.archlinux.org/index.php/Power_management</a> and I don't see<br>
>> how this can be achieved.<br>
><br>
><br>
> I usually deal with this by running `systemd-inhibit<br>
> --what=handle-lid-switch <cmd>` to prevent the auto-suspend. If you want an<br>
> automatic method, here's some scripting around UPower or udev:<br>
> <a href="https://github.com/grawity/hacks/blob/master/desktop/upower-ac-hold" rel="noreferrer" target="_blank">https://github.com/grawity/hacks/blob/master/desktop/upower-ac-hold</a> or<br>
> <a href="https://github.com/grawity/hacks/blob/master/system/ac-wait.c" rel="noreferrer" target="_blank">https://github.com/grawity/hacks/blob/master/system/ac-wait.c</a><br>
<br>
</span>Would that trigger a suspend once you unplug the machine and there is<br>
a pending request which was inhibited?</blockquote><div><br></div><div>For inhibiting handle-lid-switch, yes – logind always tries to suspend if the lid is closed currently, not just when reacting to lid events.</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>></div></div>
</div></div>