Ubuntu – How to modify the power button behaviour?

shutdown

I want the PC to shut down without any dialogue, but let time for the applications to close properly.

One solution is, to change powerbtn.sh to: shutdown -h now but that does not wait for all applications to close.

Best Answer

To do it GUI:

Install dconf-tools:

sudo apt-get install dconf-tools

open dconf-editor from dash or just run dconf-editor & in terminal

Navigate to org.gnome.settings-daemon.plugins.power and set your default button-power action there:

enter image description here

replace suspend by shutdown.