Systemd/logind: Difference between revisions
Make page translatable |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Systemd | {{breadcrumb|Systemd}} | ||
<translate> | <translate> | ||
<!--T:1--> | |||
<code>logind</code> is systemd’s login manager. | <code>logind</code> is systemd’s login manager. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:2--> | |||
Its main manual page is <code>systemd-logind.service(8)</code>. Its configuration options are described in <code>logind.conf(5)</code>. | Its main manual page is <code>systemd-logind.service(8)</code>. Its configuration options are described in <code>logind.conf(5)</code>. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
== Handling of power keys == | == Handling of power keys == <!--T:3--> | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:4--> | |||
<code>logind</code> handles power and standby hardware switches. The Arch wiki has a [https://wiki.archlinux.org/index.php/Power_management#ACPI_events good overview of which ACPI events are handled]. | <code>logind</code> handles power and standby hardware switches. The Arch wiki has a [https://wiki.archlinux.org/index.php/Power_management#ACPI_events good overview of which ACPI events are handled]. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
=== Don’t shutdown on power button press === | === Don’t shutdown on power button press === <!--T:5--> | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:6--> | |||
On a laptop, you often don’t want an accidental short press of the power button to shut down your system, but instead to <code>suspend</code> or <code>hibernate</code>. You can add the following snippet to your <code>logind</code> config: | |||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:7--> | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.logind. | services.logind.powerKey = "suspend"; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:8--> | |||
If you want to ignore short presses of the power button entirely, you can use the following snippet instead: | |||
<syntaxhighlight lang="nix"> | |||
services.logind.powerKey = "ignore"; | |||
</syntaxhighlight> | |||
Long-pressing your power button (5 seconds or longer) to do a hard reset is handled by your machine’s BIOS/EFI and thus still possible. | Long-pressing your power button (5 seconds or longer) to do a hard reset is handled by your machine’s BIOS/EFI and thus still possible. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
=== Ignore hardware keys when using <code>systemd-inhibit</code> === | === Ignore hardware keys when using <code>systemd-inhibit</code> === <!--T:9--> | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:10--> | |||
<code>systemd-inhibit</code> allows you to put a lock on e.g. shutdown or sleep that is in place as long the given process is running. By default, the hardware key actions configured in <code>logind</code> override such inhibits. | <code>systemd-inhibit</code> allows you to put a lock on e.g. shutdown or sleep that is in place as long the given process is running. By default, the hardware key actions configured in <code>logind</code> override such inhibits. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:11--> | |||
Say you want your laptop to stay awake when closing the lid in some circumstances, for example if you want to listen to music. If you start your lock screen with an inhibit on the lid switch | Say you want your laptop to stay awake when closing the lid in some circumstances, for example if you want to listen to music. If you start your lock screen with an inhibit on the lid switch | ||
</translate> | </translate> | ||
Line 42: | Line 52: | ||
</code> | </code> | ||
<translate> | <translate> | ||
<code>logind</code> | <!--T:12--> | ||
<code>logind</code> still overrides that user decision. For it to work, you need to tell logind to ignore the lid switch in your system config: | |||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:13--> | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.logind.extraConfig = '' | services.logind.extraConfig = '' |