0

Now that I managed to extend swap and enable hibernation, I'd like hibernate to be available from the menu and as an action under the power button.

I tried assigning hibernate through gsettings

$ gsettings set org.gnome.settings-daemon.plugins.power power-button-action hibernate

but it only brings up an interactive shutdown menu instead.

I have also tried looking for a GNOME extension to make hibernate visible in the menu. However, the only extension compatible with my GNOME (42.2) is Hibernate Status Button by p91paul which doesn't seem to have any effect.

How to enable hibernation with the power button and in the GNOME menu on Ubuntu 22.04?

I can successfully hibernate issuing

sudo systemctl hibernate

so the mechanism is working. I only need the UI options.

Damn Terminal
  • 2,636
  • 7
  • 27
  • 36

2 Answers2

1

OK, I have the first half of the solution. It is possible to surface hibernate in the menu.

The extension is fine but requires additional steps:

NOTE: Pop!OS and Ubuntu require a file at /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

To create this file, run:

sudo nano /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.pkla

Then copy these contents into the newly created file:

[Enable hibernate in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Enable hibernate in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes

The question of how to make the power button hibernate remains.

Damn Terminal
  • 2,636
  • 7
  • 27
  • 36
0

With your solution Dawn Terminal, all you then have to do is go to Gnome Settings->Power and select Hibernate from the Power Button Behaviour drop-down.

Nice One :-D

RAS
  • 101
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 25 '22 at 15:29