Suspend on LID close: Difference between revisions

From Alpine Linux
mNo edit summary
(Add zzz)
Line 5: Line 5:
This can be done via <code>acpid</code> with a hook in {{path|/etc/acpi/LID/00000080}}:
This can be done via <code>acpid</code> with a hook in {{path|/etc/acpi/LID/00000080}}:


# '''with pm-utils:''' {{cmd|apk add pm-utils}} {{cat|/etc/acpi/LID/00000080|#!/bin/sh
# '''with zzz:'''{{cmd|apk add zzz}} {{cat|/etc/acpi/LID/00000080|#!/bin/sh
exec zzz
}}
# '''or with pm-utils:''' {{cmd|apk add pm-utils}} {{cat|/etc/acpi/LID/00000080|#!/bin/sh
exec pm-suspend
exec pm-suspend
}}
}}
Line 19: Line 22:


= =
= =
* [https://github.com/jirutka/zzz zzz]
* [https://unix.stackexchange.com/questions/484550/pm-suspend-vs-systemctl-suspend pm-suspend vs systemd...]
* [https://unix.stackexchange.com/questions/484550/pm-suspend-vs-systemctl-suspend pm-suspend vs systemd...]
* [http://archive.md/Bcqlz pm-utils (arch wiki)]
* [http://archive.md/Bcqlz pm-utils (arch wiki)]

Revision as of 20:40, 11 September 2022

This article explains how to make your laptop go to Suspend when closing the LID.

Busybox acpid

This can be done via acpid with a hook in /etc/acpi/LID/00000080:

  1. with zzz:

    apk add zzz

    Contents of /etc/acpi/LID/00000080

    #!/bin/sh exec zzz
  2. or with pm-utils:

    apk add pm-utils

    Contents of /etc/acpi/LID/00000080

    #!/bin/sh exec pm-suspend
  3. or with raw variant:

    Contents of /etc/acpi/LID/00000080

    #!/bin/sh echo mem > /sys/power/state

Make the hook executable:

chmod +x /etc/acpi/LID/00000080

That should be it. To make sure that the acpid daemon is running, execute:

/etc/init.d/acpid start