Power Management: Difference between revisions

Sandro (talk | contribs)
DHCP (talk | contribs)
m style fixes
 
(2 intermediate revisions by 2 users not shown)
Line 48: Line 48:


Therefore, an example configuration could look like this:<syntaxhighlight lang="nix">
Therefore, an example configuration could look like this:<syntaxhighlight lang="nix">
// I'm hibernating into a logical volume that's also under LUKS. Pretty cool, right?
# I'm hibernating into a logical volume that's also under LUKS. Pretty cool, right?


swapDevices = [
swapDevices = [
Line 61: Line 61:
/dev/zram0                              partition      32881148      032767</syntaxhighlight>
/dev/zram0                              partition      32881148      032767</syntaxhighlight>


Test and use hibernation with the following command:<syntaxhighlight lang="nix">
Test and use hibernation with the following command:<syntaxhighlight lang="console">
systemctl hibernate
$ systemctl hibernate
</syntaxhighlight>
</syntaxhighlight>


== Tips and tricks ==
== Tips and tricks ==


=== Go into hibernate after specific suspend time ===
=== Hibernate after specified time ===
Using following configuration, your system will go from suspend into hibernate after 1 hour:<syntaxhighlight lang="nix">
Using following configuration, your system will go from suspend into hibernate after 1 hour:<syntaxhighlight lang="nix">
systemd.sleep.extraConfig = ''
systemd.sleep.settings.Sleep = {
   HibernateDelaySec=1h
   HibernateDelaySec = "1h";
'';
};
</syntaxhighlight>
</syntaxhighlight>


Or, to disable suspend entirely, consider a configuration like this:
=== Disable all sleep functionality ===
 
Some desktop environment and display manager combinations might attempt to put your machine to sleep as default behavior (i.e. SDDM and KDE Plasma 6 under Wayland).  If this is not what you want, you can define the following to block any service attempting to put your machine to sleep via systemd:
 
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
systemd.sleep.extraConfig = ''
systemd.sleep.settings.Sleep = {
   AllowSuspend=no
   AllowHibernation = "no";
   AllowHibernation=no
   AllowHybridSleep = "no";
   AllowHybridSleep=no
   AllowSuspend = "no";
   AllowSuspendThenHibernate=no
   AllowSuspendThenHibernate = "no";
'';
};
</syntaxhighlight>
</syntaxhighlight>


Line 130: Line 133:
You can temporarily toggle a device by writing its "Device" name back into <code>/proc/acpi/wakeup</code>
You can temporarily toggle a device by writing its "Device" name back into <code>/proc/acpi/wakeup</code>


<syntaxhighlight lang="sh">
<syntaxhighlight lang="console">
echo GPP0 | sudo tee /proc/acpi/wakeup
$ echo GPP0 | sudo tee /proc/acpi/wakeup
</syntaxhighlight>
</syntaxhighlight>