11

I'm wondering if it's possible to add a hibernate button to the power menu of ubuntu 20.04. Online I found only solutions which require the use of the terminal.

Gennaro Arguzzi
  • 680
  • 2
  • 9
  • 25
  • Hello @PRATAP thank you very much for your suggestion. Could you tell me the steps I have to follow please? I'm a newbie – Gennaro Arguzzi Jul 20 '20 at 11:04
  • The steps are in the github page which is a link shown while downloading the extension from gnome-extensions website.. Infact for testing I did follow the steps from above way.. – PRATAP Jul 20 '20 at 11:47
  • @PRATAP, time for an answer ;) – vanadium Jul 20 '20 at 14:05

1 Answers1

10

There is a extension for Hibernate Button in the Power Menu.

Hibernate gnome-shel Extension

enter image description here

Out of the box there is no effect when you click on the two items, Hibernate and Hybrid Sleep..

If you go to the Extension Homepage link provided on gnome extension website for the Hibernate Extension you will find FAQ part on the README.md

Following the workaround from the FAQ.. copy paste the below content in the file /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

[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

Open the file with below command

 sudo -H gedit /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

Copy paste the above content, save the file and close..

Reboot & Test it..

PRATAP
  • 21,989
  • 8
  • 59
  • 121
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/110818/discussion-on-answer-by-pratap-hibernate-button-on-ubuntu-20-04). – Zanna Jul 20 '20 at 18:01
  • hI @UnKNOWn can you tell me how did you create the gif in your answer please? – Gennaro Arguzzi May 17 '21 at 07:47
  • 1
    @GennaroArguzzi it is from package `byzanz`. – PRATAP May 17 '21 at 08:02
  • I wanted to confirm this also works for XFCE in Xubuntu 22.04. The Shutdown dialog now displays Hibernate and even Hybrid Sleep. The error I was getting before this fix was `xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.hibernate is authorized=FALSE`. Thank you PRATAP! – GDR Jun 14 '23 at 18:08