Systemd/logind: Difference between revisions

Unabomberlive (talk | contribs)
No edit summary
Norude (talk | contribs)
explained the powerKey, rebootKey, suspendKey, hibernateKey and lidSwitch options
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Systemd/breadcrumb}}
{{breadcrumb|Systemd}}
<translate>
<translate>
<!--T:1-->
<!--T:1-->
Line 20: Line 20:
<translate>
<translate>
<!--T:6-->
<!--T:6-->
When you use a laptop, often you don’t want an accidental short press of the power button to shut down your system. You can add the following snippet to your <code>logind</code> config:
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-->
<!--T:7-->
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.logind.extraConfig = ''
services.logind.powerKey = "suspend";
    # don’t shutdown when power button is short-pressed
    HandlePowerKey=ignore
  '';
</syntaxhighlight>
</syntaxhighlight>
</translate>
</translate>
<translate>
<translate>
<!--T:8-->
<!--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>
Similar to the power key, you can ignore the reboot, suspend and hibernate keys like this:<syntaxhighlight lang="nixos">
services.logind.rebootKey = "ignore";
services.logind.suspendKey = "ignore";
services.logind.hibernateKey = "ignore";
</syntaxhighlight>Or ignore the action of closing/opening the lid on laptops like this:<syntaxhighlight lang="nixos">
services.logind.lidSwitch = "ignore";
</syntaxhighlight></translate>
<translate>
<translate>
=== Ignore hardware keys when using <code>systemd-inhibit</code> === <!--T:9-->
=== Ignore hardware keys when using <code>systemd-inhibit</code> === <!--T:9-->