arelange / gnome-shell-extension-hibernate-status

Gnome Shell extension that adds a hibernate/hybrid suspend button in Status menu.
GNU General Public License v2.0
155 stars 56 forks source link

Support for suspend-then-hibernate to replace hybrid-sleed and if possible regular suspend #23

Closed arigit closed 10 months ago

arigit commented 5 years ago

systemd supports an alternative to hybrid mode called suspend-then-hibernate (systemclt suspend-then-hibernate)

It enters suspend immediately, but all programs a wake alarm after a configurable time, whereas if the system is not started normally prior, it will turn on the machine just to hibernate. This is commonly used in laptops but works in desktops as well. If hibernation and suspend works in the system, then suspend-then-hibernate will work as well.

The timer is configured here: /etc/systemd/sleep.conf

[Sleep] HibernateDelaySec=7200

(will suspend for 2 hours, and then wake up and hibernate)

Request: can you allow choosing via configuration to use suspend-then-hibernate instead of hybrid - and if possible regular suspend (gdm doesn't provide an option for this)

DanMan commented 4 years ago

Isn't that what you get, if you hold Alt before clicking the icon?

arigit commented 4 years ago

@DanMan nope - you get Hibernate, if hibernate is enabled (i.e. the equivalent of: systemctl hibernate). Now if your system is able to hibernate, you can also do: systemctl suspend-then-hibernate Which will suspend the system for a preconfigured amount of time, or a default time if nothing is specifically configured, and when that times out, the system will silently wake up from suspend and hibernate. All modern mac and windows laptops do this. Linux can do it too, with this little help

In my gnome shell desktop I ended up configuring a keyboard shortcut for this, but it would be much more user friendly for laptop users to have this extension to handle the use case.

DanMan commented 4 years ago

It says in the extension's description, that pressing the hibernate button while holding Alt uses hybrid mode, whatever that is. Even the icon changes while holding Alt.

arigit commented 4 years ago

I did investigate this.

Hybrid-sleep does two things: first it dumps the memory state on disk and THEN it suspends, every time you invoke it. This lets the system wake up quickly but: a) drains the battery indefinitely, and b) does a massive file write, not cool if you are using SSD/nvme

What I'm asking here is to give the option to do "Suspend-then-Hibernate" instead of hybrid-sleep. Which is fully supported by systemctl for any system that is able to hibernate. What it does is: It suspends immediately to RAM, without writing anything to disk. Then after a timeout period, if the machine wasn't woken up by the user, it will wake up silently, write the RAM contents to disk and go hibernate. This minimizes the chances of massive file writing, and also prevents the battery from draining if the machine is stored for longer periods of time.

The time period to go from suspend to hibernate is configurable in /etc/systemd/sleep.conf

[Sleep] HibernateDelaySec=7200

... 2 hours in this example.

juxuanu commented 4 years ago

I would like to have this aswell. In my laptop I always do suspend-then-hibernate. I have no interest in hybrid-sleep.

mystiquewolf commented 3 years ago

Looks useful.

AlbyM-dev commented 1 year ago

this would be super useful and that's what I was looking for ... any plan to implement it soon ? thanks!

p91paul commented 1 year ago

PR #81 needs resolving some merge conflicts before merging, but I've had some free time issues and I cannot give a timeline unfortunately

sneeed commented 1 year ago

I would love to have this feature as well. Thanks for your addon!