Ask Your Question
1

How to change default action when pressing power button on laptop

asked 2015-11-06 13:36:26 -0500

pawiecki gravatar image

I want a dialog to ask me what to do, when I press power button on my laptop (the same as clicking system menu on top right corner and power icon, or pressing at once Ctrl+Alt+Delete).

I used to have this in F22, but after upgrading to F23 I can't find the option to change this, and by default system suspends, which is something i don't like.

So far I checked:

System Settings => Power - nope; Gnome Tweak Tool => Power - nope; Dconf Editor => org.gnome.settings-daemon.plugins.power => option "button-power" set to "interactive" - but still nope.

Please help me escape this suspending nightmare and bring back sanity to my humble life.

edit retag flag offensive close merge delete

Comments

I have the same problem in F23. Since my laptop (Lenovo Thinkpad E540) does not awake from suspend - I learned that suspend mode is not well supported on some HW - it means a cold restart by a long press of the power button each time I forget to use Ctrl-Alt-Del instead of the power button. I checked the Dconf Editor by: $ sudo gsettings range org.gnome.settings-daemon.plugins.power power-button-action This yields: enum 'nothing' 'suspend' 'hibernate' Which means that options 'interactive' and 'shutdown' have disappeared. I hope that a more knowledgeable person than me understands why.

JanvdK gravatar imageJanvdK ( 2016-02-06 07:15:19 -0500 )edit

On fedora 23 dconf editor returns an error telling me "interactive" is no valid value for this setting.

Cannot believe such a essential feature has been removed from gnome?

jbmusicdd gravatar imagejbmusicdd ( 2016-03-13 17:15:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-29 09:14:02 -0500

fat-lobyte gravatar image

This functionality has been removed in Gnome 3.18.

The GNOME maintainers don't care too much about this, but I there is a bug report where you can complain: https://bugzilla.gnome.org/show_bug.c...

I will wait a bit for a reaction and then create a new issue on the GNOME bugtracker, because after going through several pages of a Google search, there are a lot of people asking for this feature. The good news is that the handling code is still there, so there is a somewhat trivial patch to gnome-settings-daemon that will get you the "interactive" value back:

From 3d9c3ecda9c68039c309bfb6bfc93830c4a0e20e Mon Sep 17 00:00:00 2001
From: Felix Zhang <fezhang@suse.com>
Date: Mon, 12 Sep 2016 18:00:07 +0800
Subject: [PATCH] more power button actions

---
 data/gsd-enums.h                            | 2 ++
 plugins/media-keys/gsd-media-keys-manager.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/data/gsd-enums.h b/data/gsd-enums.h
index 4a0356a..87fd158 100644
--- a/data/gsd-enums.h
+++ b/data/gsd-enums.h
@@ -113,6 +113,8 @@ typedef enum
 typedef enum
 {
   GSD_POWER_BUTTON_ACTION_NOTHING,
+  GSD_POWER_BUTTON_ACTION_INTERACTIVE,
+  GSD_POWER_BUTTON_ACTION_SHUTDOWN,
   GSD_POWER_BUTTON_ACTION_SUSPEND,
   GSD_POWER_BUTTON_ACTION_HIBERNATE
 } GsdPowerButtonActionType;
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index d77ed10..e9611b9 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1929,6 +1929,12 @@ do_config_power_button_action (GsdMediaKeysManager *manager,

         action_type = g_settings_get_enum (manager->priv->power_settings, "power-button-action");
         switch (action_type) {
+        case GSD_POWER_BUTTON_ACTION_INTERACTIVE:
+                do_config_power_action (manager, GSD_POWER_ACTION_INTERACTIVE, in_lock_screen);
+                break;
+        case GSD_POWER_BUTTON_ACTION_SHUTDOWN:
+                do_config_power_action (manager, GSD_POWER_ACTION_SHUTDOWN, in_lock_screen);
+                break;
         case GSD_POWER_BUTTON_ACTION_SUSPEND:
                 do_config_power_action (manager, GSD_POWER_ACTION_SUSPEND, in_lock_screen);
                 break;
-- 
2.6.6

I will create a Bug report on the Fedora side, maybe they are more inclined to fix it. I will report against Rawhide, that means if it's accepted, it will end up in F26 the soonest, which is probably in a year or soemthing?

The workaround until then is to rely on the Ctrl-Alt-Del shortcut.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-06 13:36:26 -0500

Seen: 1,517 times

Last updated: Nov 29 '16