Ubuntu – Change “power-button-action” comand for “hibernate” option in GNOME 3.18


I am used to have an interactive menu when i press my power button, but since I recently installed GNOME 3.18, i found out that the only available actions for power button press are : "nothing", "suspend" and "hibernate".

In dconf-editor, there are two entries for this:

org.gnome.settings-daemon.plugins.power button-power
org.gnome.settings-daemon.plugins.power power-button-action

The first one contains all options (hibernate, interactive, suspend, poweroff, nothing,..), but the second one contains only three (hibernate, suspend, nothing).

The problem is that it seems that GNOME uses the second entry (power-button-action).

Since i don't want to use hibernate, and suspend does not work on my computer (that's another issue), i'd like to map an interactive menu to be executed when power-button-action is set to hibernate.

The command for the interactive menu i want is:

gnome-session-quit --power-off

I run Ubuntu GNOME 16.04 LTS 64-bit with GNOME Shell 3.18.4 on a Dell Inspiron 3537.

More generaly, i would like to be able to display the interactive shutdown menu when pressing the power button (by any means necessary, no especially going through this way). I tried to map the power button to gnome-session-quit --power-off using the GNOME keyboard setting, but it doesn't seem to be triggered.

Thank you.

Best Answer

This functionality was intentionally removed in commit 50564cde49ca2 (for bug 753713). After some discussion, it's returned in gnome-settings-daemon 3.20.

Unfortunately, 3.20 is not in the 16.04 ubuntu repos (however you can see that there is a 3.20 release for Yakkety 16.10).

gnome3-staging ppa contains an appropriate package (3.20.1-2ubuntu1~ubuntu16.04.1), but I believe that requires updating your entire gnome installation to the staging stream (which is like a beta).

I don't know if you can grab a deb of the right package and install that somehow.

This question has alternative instructions for how to modify the code and compile a working version.

I'm sorry there isn't a better answer for this and that these disruptive changes were introduced in a LTS release. You can vote on this bug to get 3.20 released in Xenial.