Enable and modify HandleLidSwitch = lock of/etc/system/logind. conf to save and run the systemctlrestartsystemd-logind command to take effect immediately. Reference: PowerManagement (simplified Chinese) systemd can process certain power-related ACPI & nb
Enable and modify/etc/system/logind. conf
HandleLidSwitch = lock
Save and run the systemctl restart systemd-logind command to take effect immediately.
Refer:
Power Management (simplified Chinese)
SystemdCan handle certain power supply-related ACPI events, through/etc/systemd/logind.conf
Configuration of the following options:
HandlePowerKey
: Action after pressing the power key
HandleSleepKey
: Action after pressing the hold key
HandleHibernateKey
: The action after the sleep key is pressed.
HandleLidSwitch
: Standby mode after the laptop is closed
The action can beignore
,poweroff
,reboot
,halt
,suspend
,hibernate
,hybrid-sleep
,lock
Orkexec
.
The default settings are as follows:
HandlePowerKey=poweroffHandleSuspendKey=suspendHandleHibernateKey=hibernateHandleLidSwitch=suspend
Without graphical interfaces or simple desktop managers such as i3 and awesome, systemd can replace acpid to process ACPI events.
Note:Run
systemctl restart systemd-logind
To make the above changes take effect immediately.
Note:Systemd cannot handle AC power and battery ACPI events, so Laptop Mode Tools or acpid Tools must be used.
In the current version of systemdHandle
The options will be applied to the entire system unless they are blocked by other programs, such as the power manager in a desktop environment ). If other programs do not stop theseHandle
, You may first be suspended by systemd, and then when the system is awakened, the Power Manager will again suspend the system.
Warning:Currently, only GNOME and KDE support the "inhibited" command. If you want to use Xfce, acpid, or other programs to manage ACPI events
Handle
Option
ignore
.
Note:In addition to the default back-end (for processing the standby/sleep) supported by the kernel, systemd can also use other backend (such as Uswsusp or TuxOnIce ).
Ordersystemctl hibernate
To work, follow the settings of sleep and mkinitcpio wake-up extension. (No installation requiredpm-utils
)