GNOME Bugzilla – Bug 781108
Add power off option to power off button
Last modified: 2018-02-25 14:25:39 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
*** Bug 781817 has been marked as a duplicate of this bug. ***
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.
Please add also 'interactive' and 'logout' as for 'When Laptop Lid is Closed'
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)
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
(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.
(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" ?
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.
(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
(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.
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
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.
Created attachment 357131 [details] [review] build: Require gnome-settings-daemon 3.25.90 another gnome-control-center patch
Review of attachment 353610 [details] [review]: go ahead and push this one
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
Review of attachment 357131 [details] [review]: I'll push this after I release g-s-d, thanks!
Attachment 357130 [details] pushed as 62c86c7 - power: Restore Power Off option for Power Button
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'
Attachment 357131 [details] pushed as 8282ba0 - build: Require gnome-settings-daemon 3.25.90
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).
*** Bug 792525 has been marked as a duplicate of this bug. ***
*** Bug 759667 has been marked as a duplicate of this bug. ***
So in which gsd/distro version has it been 'fixed'? How can we pull the changes?
Roman, you can use any distro that provides GNOME 3.26. Several are mentioned at https://www.gnome.org/getting-gnome/
(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.
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.