Systemd/logind: Difference between revisions

Ardenet (talk | contribs)
Tags: Mobile edit Mobile web edit
Hb (talk | contribs)
m Handle Lid Switch was also renamed
 
(3 intermediate revisions by 3 users not shown)
Line 19: Line 19:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.logind.powerKey = "suspend";
services.logind.settings.Login.HandlePowerKey = "suspend";
</syntaxhighlight>
</syntaxhighlight>


<translate>
<translate>
<!--T:14-->
If you want to ignore short presses of the power button entirely, you can use the following snippet instead:
If you want to ignore short presses of the power button entirely, you can use the following snippet instead:
</translate>
</translate>


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.logind.powerKey = "ignore";
services.logind.settings.Login.HandlePowerKey = "ignore";
</syntaxhighlight>
</syntaxhighlight>


Line 34: Line 35:
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.


<!--T:15-->
Similar to the power key, you can ignore the reboot, suspend and hibernate keys like this:
Similar to the power key, you can ignore the reboot, suspend and hibernate keys like this:
</translate>
</translate>


<syntaxhighlight lang="nixos">
<syntaxhighlight lang="nixos">
services.logind.rebootKey = "ignore";
services.logind.settings.Login.HandleRebootKey = "ignore";
services.logind.suspendKey = "ignore";
services.logind.settings.Login.HandleSuspendKey = "ignore";
services.logind.hibernateKey = "ignore";
services.logind.settings.Login.HandleHibernateKey = "ignore";
</syntaxhighlight>
</syntaxhighlight>


<translate>
<translate>
<!--T:16-->
Or ignore the action of closing/opening the lid on laptops like this:
Or ignore the action of closing/opening the lid on laptops like this:
</translate>
</translate>


<syntaxhighlight lang="nixos">
<syntaxhighlight lang="nixos">
services.logind.lidSwitch = "ignore";
services.logind.settings.Login.HandleLidSwitch = "ignore";
</syntaxhighlight>
</syntaxhighlight>


Line 61: Line 64:
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


<!--T:17-->
<code>systemd-inhibit --what=handle-lid-switch lock-screen-tool</code>
<code>systemd-inhibit --what=handle-lid-switch lock-screen-tool</code>


Line 68: Line 72:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.logind.extraConfig = ''
services.logind.settings.Login = {
   # want to be able to listen to music while laptop closed
   # If you want to listen to music while the lid is closed
   LidSwitchIgnoreInhibited=no
   HandleLidSwitch = "ignore";
'';
};
</syntaxhighlight>
</syntaxhighlight>


<translate>
<translate>
<!--T:18-->
[[Category:Applications]]
[[Category:Applications]]
[[Category:systemd]]
[[Category:systemd]]
</translate>
</translate>