Ubuntu – How to shut down Lubuntu immediately with the power button instead of a logout method dialog prompt

lubuntupower-managementshutdown

I would like the computer to shut down directly after I press the power button. At the moment, Lubuntu opens a shutdown method dialog box when I press the shutdown button.

I suspect I can simply modify the Lubuntu-rc.xml file in the .config/openbox/ folder. I used that file to easily change other shortcut keys. If this is the case, I believe I have found the proper line of code where the shutdown command should be. But when I enter the command "sudo shutdown – now" in the appropriate place, it doesn't work. Is there another command I should enter for the physical power button to shutdown the computer immediately?

`<!-- Launch logout when push on the shutdown button -->
<keybind key="XF86PowerOff">
  <action name="Execute">
    <command>lxsession-default quit</command>
  </action>
</keybind>`

Best Answer

This is a configurable option in the XFCE Power Manager, which was installed by default in my relatively fresh Lubuntu 14.04.1 installation (a laptop). I found it at Preferences > Power Manager. If it's not installed already for you, you should be able to install it with sudo apt-get install xfce4-power-manager

In "General Options", you'll want to select "When power button is pressed: Shutdown" (default setting is "Ask" - which brings up the popup menu you want to skip). See the starred line in the image below.

Xfce Power Manager General Options screen with power button setting indicated by red stars.

I needed to log out of Lubuntu and log back in for this setting to take effect, but after that, one press of the power button shut down my system.

Hope this works for you!