Re: [FF-laptop-LSU] Power Discussion Thread - Lid Close Command/Action (fwd)

From: Oleksandr Kryvulia <shuriku_at_shurik.kiev.ua>
Date: Wed, 09 Apr 2025 05:41:56 UTC
Both /etc/rc.suspend and /etc/rc.resume is called by devd(8). If needed 
one can write own hooks for devd(8) on lid close/open.

08.04.25 21:57, Chris Moerz:
> Hi vermaden,
>
> thanks for getting in touch! I suggest we post this to the mailing list,
> so the others can see this as well.
>
> For the moment, that's the canonical way for providing inputs and feedback
> to the Foundation's laptop and project roadmap.
>
> We will have another LDWG call tomorrow - I hope to raise this tomorrow as
> well.
>
> Thank you!
> chris
>
> ---------- Forwarded message ----------
> Date: Tue, 01 Apr 2025 23:21:59 +0200
> From: vermaden <vermaden@interia.pl>
> To: freebsd@ny-central.org
> Subject: FreeBSD Laptop/Desktop Group - Lid Close Command/Action
>
>
> Hi,
>
> I wanted to create Lid Close Command/Action issue but seems that I do not have needed permissions.
>
> Could You create one? I thinks this would be useful. Thanks.
>
> Issue Title: Lid Close Command/Action
>
> Issue Description:
> Hi,
>
> we know that we can configure FreeBSD to put system into sleep by closing the lid with `hw.acpi.lid_switch_state` being set to `S3` ... but that will only suspend the system
> - it will not LOCK it.
>
> ```
> % sysctl -d -n hw.acpi.lid_switch_state
> Lid ACPI sleep state. Set to S3 if you want to suspend your laptop when close the Lid.
> ```
>
> As described here:
> - https://mastodon.bsd.cafe/@lily@duke.social/114264333623026887
>
> My current workaround solution is:
>
> 1. Use `[WIN]+[L]` shortcut for lock:
> - https://github.com/vermaden/scripts/blob/master/__openbox_lock.sh
>
> 2. Use `[CTRL]+[WIN]+[ALT]+[L]` shortcut for lock and suspend:
> - https://github.com/vermaden/scripts/blob/master/__openbox_lock_zzz.sh
>
> Now - my proposal - as we already have `/etc/rc.suspend` and `/etc/rc.resume files` - I would add `/etc/rc.lidclose` file that will be executed when lid is closed and
> `/etc/rc.lidopen` when someone opens the lid.
>
> It can be also done via `sysctl(8)` like `hw.acpi.lid_command` for example ... just a rough idea to solve the problem.
>
> If for some reason its already covered by other issue - please close - thanks.
>
> Regards,
> vermaden
>
>
>
>