Ubuntu – How to shut down the computer safely by pressing the power button

buttonpower-managementshutdown

So this is pretty simple: when I press the power button whilst the machine is on, it comes up with a menu (of which one of the options is to shutdown)

However, I just want it to just start shutting down once I press the power button without any further interaction!

How do I accomplish this?

Best Answer

Yes, that is exactly how I'm running: a light tap on the power button just shuts down the machine!

Just press Ctrl+Alt+T to go to a terminal and type:

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

VoilĂ : The power button now powers off the machine!

To be completely honest: the other day I was at a friend and one of her cats ran across my laptop and shut down the machine, so to be avoided near cats! ;-)