Power button prompts for confirmation!


Can anyone tell me is it possible to configure F31 to power down directly (without prompting) when the power button is pressed?
I can’t find any reference online.



Only works for suspend, but not for poweroff.

I am just press (not hold, or it will emergency shutdown with possible data loss) the button on the top of my laptop.

1 Like

Thank you Vitaliy for your reply, however it seems you misunderstood the question. I want the machine to shut down gracefully when I press the button.

I note some debate about this on the forums of another Linux flavour. Also, this behaviour is standard in ‘that other’ OS!
Obviously this is not a show stopper but I firmly believe that as I am the human, if I press a button I expect the machine to do what it’s told.
Looks like I’ll have to learn how to patch and rebuild if I want this functionality. Think I’ve come to Linux a little late. My enthusiasm for programming waned some time ago!



Oh…That is asks for confirmation, actually…

  1. Also your can write a script:
    #! /bin/bash

    systemctl poweroff

  2. chmod u+x script.sh

  3. and make a shortcut.

  4. Err... yes, needs sudo, sucks...

systemctl poweroff doesn’t need sudo here.

Indeed, if you issue this command:
gsettings get org.gnome.settings-daemon.plugins.power power-button-action

While in the GUI you see “Power Off”, it is actually “interactive”.

And the possible values are:

$ gsettings range org.gnome.settings-daemon.plugins.power power-button-action


So, I guess, one thing to do could be to set to nothing and find a way to intercept (using dbus? acpi? udev? polling journalctl?) that the power button was pressed (indeed in journalctl you can see this line systemd-logind[1350]: Power key pressed. )

Sorry but I can’t be of more help.

1 Like


Gnome devs about that decision (Sounds sane).

$ systemd-inhibit

WHO                            UID  USER PID  COMM            WHAT                                                     WHY                                                         MODE 
ModemManager                   0    root 884  ModemManager    sleep                                                    ModemManager needs to reset devices                         delay
NetworkManager                 0    root 979  NetworkManager  sleep                                                    NetworkManager needs to turn off networks                   delay
UPower                         0    root 1378 upowerd         sleep                                                    Pause device polling                                        delay
gnome-tweak-tool-lid-inhibitor 1000 vits 1578 gnome-tweak-too handle-lid-switch                                        user preference                                             block
vits                           1000 vits 1534 gsd-power       handle-lid-switch                                        External monitor attached or configuration changed recently block
vits                           1000 vits 1533 gsd-media-keys  handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                                   block
vits                           1000 vits 1533 gsd-media-keys  sleep                                                    GNOME handling keypresses                                   delay
vits                           1000 vits 1534 gsd-power       sleep                                                    GNOME needs to lock the screen                              delay

8 inhibitors listed.


Screenshot showing part of Gnome3 Settings app being opened on a Power tab.  A Power Button Action is set to Nothing.


Set InhibitorsMax=0 in /etc/systemd/logind.conf.
  • HandlePowerKey=poweroff is default

  • Setting PowerKeyIgnoreInhibited=yes instead of above is not working...
    ( 🤪️ man logind.conf: "Low level inhibitor locks ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch"), are always honored, irrespective of this setting.")


Pressing power button causes shutdown -- without confirmation.

PS: Now, obvious question: Where is i am exhibit idiotic and dangerous behavior?

Disclaimer: If i were your, i'm rather use a custom shortcut!

1 Like

I don’t understand: with these steps, power off without confirmation works or not?
(Take into account that as far as I can understand, gnome considers the power button as a media key, like volume up, and it is not in line with systemd?.. Well too complex for me).

Who says that it is idiotic? I agree that it is dangerous, because there are computers where it is too simple to hit the power button by accident.


  1. Power Button Action [Nothing]
  2. Set InhibitorsMax=0 in /etc/systemd/logind.conf.
  3. Works, if HandlePowerKey=poweroff is default

Just a PowerKeyIgnoreInhibited=yes is a wrong option.

PS: In dconf-editor:
org.gnome.settings-daemon.plugins.media-keys power-static [‘XF86PowerOff’]

Setting it to [’’] gives me nothing.

Hi All,
Just wanted to say many thanks for all the feedback, much appreciated!