How to turn off computer with one click in GNOME Shell 45.2?

In older gnome version it was possible to do so with dconf app. I could just press power button and system turned itself off right away. It was so convenient - no annoying dialogue box that it will turn itself off in 60 seconds - just two cliks with mouse or one with power button.
Is it possible to do it now?
Thank you

Hello? m? :grinning: :smiley: :smile: :grin: :laughing: :sweat_smile: :rofl: :joy:

So why, oh why? And how? m?

I use an extension and also helps by making an hibernation button. One click to restart or hibernate.

I use it as well, but there is no more option to enable instant shutdown like it was before or maybe because now I installed Silverblue 39 and it was hidden.
What operating system you are using? is it GNOME Shell 45.2?

Using Manjaro latest stable

Set a keybinding in settings to run this command:

shutdown -P now

be careful though you might lose your unsaved works after pressing keys

1 Like

it works if sudo is added at a beginning, but it would be better if it could should down with one power button press. :frowning:

What’s the point?

You can hold the power button until it’s off but it might leave some programs unfinished or changes unsaved.

Or you can choose shutdown when pressing power button even though you have to confirm before shutting down… Or wait 60 seconds for it to shutdown itself

1 Like

It is not convenient.
Now I am powering off by pressing power button > left button > enter. Three buttons instead just one! Maybe it is good for finger training. I can do it very fast :smiley:

Longpressing power button to turn of computer is not a solution. It’s just a emergency shut-off when system freezes. Invoking it might lead to data loss.

If you have no objection using a shell script to reach your goal of turning off computer immediately by pressing power button, I have a solution for you.
The script will check if you are running GNOME and if power button action in energy settings in GNOME control center is set to nothing.
If so, it will turn off computer, when power button is pressed.
You can try it by running the script in terminal. If it does what you want it to do, make sure the script autostarts when logging in to GNOME.
Take note that the scripts waits 5 secs when executed before it will start listen to power button. This is just meant as time waiting for GNOME to be fully loaded when evoking script on autostart.

sleep 5

## ensures that it will only work on GNOME
if [  "$de" != GNOME  ]; then

while true; do

##ensures that it will only work if power button action is set to nothing in gnome-control-center
gnomepowerbuttonsettings=`gsettings get org.gnome.settings-daemon.plugins.power power-button-action | grep -c nothing`
if [  "$gnomepowerbuttonsettings" = 1  ]; then
buttonwatch=`journalctl --since "0.3 sec ago" --until "now" | grep -c "Power key pressed short"`
if [  "$buttonwatch" = 1  ]; then
systemctl poweroff &
sleep 0.1

Thank you. I will try it later. I wish gnome developers could just make a thick box to disable those warning messages. :frowning:

You can turn off the system using a D-Bus command, which can be assigned to a keyboard shortcut:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true