How to configure the power off button to just power off instantly in Ubuntu 17.10 (Gnome)

I would like my Computer to just power off when I press the hardware Power Button. Instead I dialog with a countdown and Options (Cancel, Restart, Power Off) comes up. How to disable this dialog and power off immediately?

Or at least, how to set the countdown to much, much less then 60 seconds?


Solution 1:

Ubuntu 18.04

gsettings set org.gnome.SessionManager logout-prompt false

or you can also try

gsettings set com.canonical.indicator.session suppress-logout-restart-shutdown true

Solution 2:

In Ubuntu 20.10 I found it under org.gnome.settings-daemon.plugins.power. The default value is interactive, but you can change it to shutdown.

Change it using gsettings like pasha's answer, or use dconf-editor, which has a GUI.

Solution 3:

Using

org.gnome.gnome-session logout-prompt 'false'

and

org.gnome.settings-daemon.plugins.power button-power 'shutdown'

worked for me on Ubuntu 20.04 LTS. A nice side effect is, that this also causes immediately Power-Off by HDMI-CEC controls.