After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781108 - Add power off option to power off button
Add power off option to power off button
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.22.x
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
: 759667 781817 792525 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-04-09 22:53 UTC by Jasper
Modified: 2018-02-25 14:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
media-keys: Add "shutdown" as a possible option for power button (1.77 KB, patch)
2017-05-04 13:17 UTC, Morse
none Details | Review
media-keys: Restore interactive option for power button (1.75 KB, patch)
2017-06-12 17:00 UTC, Jeremy Bicha
committed Details | Review
power: Restore Power Off option for Power Button (903 bytes, patch)
2017-08-07 16:49 UTC, Jeremy Bicha
committed Details | Review
build: Require gnome-settings-daemon 3.25.90 (830 bytes, patch)
2017-08-07 16:50 UTC, Jeremy Bicha
committed Details | Review
Screenshot from GNOME 3.26 (64.62 KB, image/png)
2018-02-25 14:25 UTC, André Klapper
  Details

Description Jasper 2017-04-09 22:53:09 UTC
Currently, the only options for the Power Button are 'nothing', 'suspend' and 'hibernate'. It is not possible to power off the PC by pressing the power button (arguably the intended use of a power button).

According to commit [69d9d8b1eda2d50acca5b4da58003afb8b82a7f1][1], that option was removed because it "would make the default action too destructive", however I fail to see how adding a non-default option of power off would make the default option any more destructive.

[1]: https://github.com/GNOME/gnome-settings-daemon/commit/69d9d8b1eda2d50acca5b4da58003afb8b82a7f1
Comment 1 Bastien Nocera 2017-05-04 11:21:39 UTC
*** Bug 781817 has been marked as a duplicate of this bug. ***
Comment 2 Morse 2017-05-04 13:17:54 UTC
Created attachment 351047 [details] [review]
media-keys: Add "shutdown" as a possible option for power button

Re-uploaded the patch from the duplicate bug.

In commit 69d9d8b the configuration for the power button action was
added, consisting of three options "suspend", "hibernate", and "nothing".

This commit adds the "shutdown" option, which is needed in various cases.
Comment 3 corrado venturini 2017-05-29 10:12:25 UTC
Please add also 'interactive' and 'logout' as for 'When Laptop Lid is Closed'
Comment 4 Jeremy Bicha 2017-06-12 17:00:03 UTC
Created attachment 353610 [details] [review]
media-keys: Restore interactive option for power button

I believe it's a popular and reasonable request for users to be able to Power Off their computer when they press the Power button.

Earlier, it was seen as too destructive for the computer to immediately power off when the button was pressed because this could be pressed accidentally.

Fortunately, there's an interactive option which gives the user one minute to cancel the Power Off request in case of accidents. I'd like to support this in Tweak Tool as seen in this mockup:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/tweak-tool/tweak-tool-wires.png
(Ignore the Blank screen and Logout options)
Comment 5 Rui Matos 2017-07-19 16:10:21 UTC
Review of attachment 353610 [details] [review]:

we'll need a corresponding change to g-c-c's power panel

::: data/gsd-enums.h
@@ +108,3 @@
   GSD_POWER_ACTION_INTERACTIVE,
   GSD_POWER_ACTION_NOTHING,
+  GSD_POWER_ACTION_LOGOUT

please drop this change
Comment 6 Jeremy Bicha 2017-07-19 16:58:20 UTC
(In reply to Rui Matos from comment #5)
> Review of attachment 353610 [details] [review] [review]:
> 
> we'll need a corresponding change to g-c-c's power panel

Ok, it sounds like you want this new Power Off option to be added to gnome-control-center. But currently, Tweak Tool (and g-s-d) allows setting Hibernate which is not an option in gnome-control-center. If a user sets Hibernate, then gnome-control-center shows "When the Power Button is pressed" is set to "Nothing". So that is already broken before this change.

On the other hand maybe we don't want to make it easy for users to set the Hibernate option since it will likely require additional user action for Hibernate to actually work. (Sufficient swap space dedicated and hoping that there isn't a hardware problem.).

I do like the idea of having this setting be in gnome-control-center instead of Tweak Tool so maybe it's ok to just drop it from Tweak Tool and not offer Hibernate in gnome-control-center's dropdown or listbox. After all, it is confusing to have two different GUI ways slightly different to configure the same thing.

> ::: data/gsd-enums.h
> @@ +108,3 @@
>    GSD_POWER_ACTION_INTERACTIVE,
>    GSD_POWER_ACTION_NOTHING,
> +  GSD_POWER_ACTION_LOGOUT
> 
> please drop this change

Sure, I can do that but it is the only enum series with a trailing space in that file.
Comment 7 Rui Matos 2017-08-07 14:57:19 UTC
(In reply to Jeremy Bicha from comment #6)
> Ok, it sounds like you want this new Power Off option to be added to
> gnome-control-center. But currently, Tweak Tool (and g-s-d) allows setting
> Hibernate which is not an option in gnome-control-center. If a user sets
> Hibernate, then gnome-control-center shows "When the Power Button is
> pressed" is set to "Nothing". So that is already broken before this change.

True, we should fix that somehow (different bug) but let's not introduce yet another case.

> On the other hand maybe we don't want to make it easy for users to set the
> Hibernate option since it will likely require additional user action for
> Hibernate to actually work. (Sufficient swap space dedicated and hoping that
> there isn't a hardware problem.).

Right, we might end up removing hibernate completely.

> I do like the idea of having this setting be in gnome-control-center instead
> of Tweak Tool so maybe it's ok to just drop it from Tweak Tool and not offer
> Hibernate in gnome-control-center's dropdown or listbox. After all, it is

hibernate?

> confusing to have two different GUI ways slightly different to configure the
> same thing.

assuming you meant the interactive option above as that's what this is about; yes, I think we should add it to g-c-c, not sure about the label, perhaps "Ask" ?
Comment 8 Jeremy Bicha 2017-08-07 15:01:05 UTC
I think we should use "Power Off" as the label since it will open the Power Off dialog and it will power off the computer in 60 seconds unless canceled.
Comment 9 Rui Matos 2017-08-07 15:07:07 UTC
(In reply to Jeremy Bicha from comment #8)
> I think we should use "Power Off" as the label since it will open the Power
> Off dialog and it will power off the computer in 60 seconds unless canceled.

maybe "Power Off..." then? just "power off" seems like something that will happen without confirmation
Comment 10 Bastien Nocera 2017-08-07 15:22:16 UTC
(In reply to Rui Matos from comment #7)
> (In reply to Jeremy Bicha from comment #6)
> > Ok, it sounds like you want this new Power Off option to be added to
> > gnome-control-center. But currently, Tweak Tool (and g-s-d) allows setting
> > Hibernate which is not an option in gnome-control-center. If a user sets
> > Hibernate, then gnome-control-center shows "When the Power Button is
> > pressed" is set to "Nothing". So that is already broken before this change.
> 
> True, we should fix that somehow (different bug) but let's not introduce yet
> another case.
> 
> > On the other hand maybe we don't want to make it easy for users to set the
> > Hibernate option since it will likely require additional user action for
> > Hibernate to actually work. (Sufficient swap space dedicated and hoping that
> > there isn't a hardware problem.).
> 
> Right, we might end up removing hibernate completely.

"CanHibernate" in logind is there to be called. That's what upower does.
Comment 11 Jeremy Bicha 2017-08-07 15:43:24 UTC
My problem with Hibernate was because Ubuntu disabled it by default. After I overrode that, I can see the Hibernate option so I think gnome-control-center is correct here.

https://askubuntu.com/questions/94754/how-to-enable-hibernation
Comment 12 Jeremy Bicha 2017-08-07 16:49:28 UTC
Created attachment 357130 [details] [review]
power: Restore Power Off option for Power Button

Patch for gnome-control-center, requires the g-s-d patch to be applied first

I prefer Power Off without the ellipsis but I'll leave that decision to you.
Comment 13 Jeremy Bicha 2017-08-07 16:50:02 UTC
Created attachment 357131 [details] [review]
build: Require gnome-settings-daemon 3.25.90

another gnome-control-center patch
Comment 14 Rui Matos 2017-08-07 17:19:57 UTC
Review of attachment 353610 [details] [review]:

go ahead and push this one
Comment 15 Rui Matos 2017-08-07 17:21:27 UTC
Review of attachment 357130 [details] [review]:

::: panels/power/cc-power-panel.c
@@ +2066,3 @@
   } actions[] = {
     { N_("Suspend"), GSD_POWER_BUTTON_ACTION_SUSPEND },
+    { N_("Power Off…"), GSD_POWER_BUTTON_ACTION_INTERACTIVE },

Allan prefers without ellipsis too. That's 2-1 so let's go without
Comment 16 Rui Matos 2017-08-07 17:22:00 UTC
Review of attachment 357131 [details] [review]:

I'll push this after I release g-s-d, thanks!
Comment 17 Jeremy Bicha 2017-08-07 17:25:06 UTC
Attachment 357130 [details] pushed as 62c86c7 - power: Restore Power Off option for Power Button
Comment 18 Jeremy Bicha 2017-08-07 17:44:46 UTC
I've removed the duplicate section from the Tweaks app:
https://git.gnome.org/browse/gnome-tweak-tool/commit/?id=e5ffcb222

Tweaks > Power has only one setting now:
an on/off switch for 'Suspend when laptop lid is closed'
Comment 19 Rui Matos 2017-08-09 17:39:39 UTC
Attachment 357131 [details] pushed as 8282ba0 - build: Require gnome-settings-daemon 3.25.90
Comment 20 Frank 2017-11-09 19:12:45 UTC
Rui: You mentioned that you want to abandon hibernate at all. What about the hybrid mode, where data gets written to the RAM and the disk/flash. This way we could use hibernate if the RAM’s still powered and the machine supports it – and otherwise suspend should be used automatically. (I mean substituting hibernate by hybrid-hibernate and still leaving suspend for retaining battery charge).
Comment 21 Piotr Drąg 2018-02-24 00:31:49 UTC
*** Bug 792525 has been marked as a duplicate of this bug. ***
Comment 22 Piotr Drąg 2018-02-24 00:32:03 UTC
*** Bug 759667 has been marked as a duplicate of this bug. ***
Comment 23 Roman Zabaluev 2018-02-25 12:41:51 UTC
So in which gsd/distro version has it been 'fixed'? How can we pull the changes?
Comment 24 Jeremy Bicha 2018-02-25 13:03:39 UTC
Roman, you can use any distro that provides GNOME 3.26.

Several are mentioned at https://www.gnome.org/getting-gnome/
Comment 25 Roman Zabaluev 2018-02-25 14:20:47 UTC
(In reply to Jeremy Bicha from comment #24)
> Roman, you can use any distro that provides GNOME 3.26.
> 
> Several are mentioned at https://www.gnome.org/getting-gnome/

Thank you, but I'm using gnome 3.26.2 and there's no such an option.
Comment 26 André Klapper 2018-02-25 14:25:39 UTC
Created attachment 368896 [details]
Screenshot from GNOME 3.26

Roman: See screenshot. If that does not exist for you, please ask in a support forum of your distribution. Thanks.