2

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>`
2

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!

|improve this answer|||||
  • Hello, I also have the same Xfce Power Manager on my Lubuntu 14.10. My already have it at shutdown, I tried switching it back to ask, restarting, and switching back to shutdown, and no luck. My settings for 'power button pressed' are also 'shutdown', but it still asks when I press the button. Mystifying. – Rockishi Jan 13 '15 at 19:55
  • That's strange - it worked for me on 14.04. I'll take another look. – drkokandy Jan 14 '15 at 20:58
  • doesn't seem to work anymore as of ubuntu 18.04, here 😐 no matter what the setting is set to, the dialog appears (yes, xfce4-power-button is running and acpid is installed) – wump Mar 25 at 12:03
0

Please try this. It works in Ubuntu and may work in Lubuntu:

Tap the power button then press the enter key.

I'm always surprised when seasoned ubuntu users don't seem to know that this easy trick which can performed as swiftly as half a second shuts down the computer properly and fastest of all. Like I said, it might not work in Lubuntu but you can at least try.

|improve this answer|||||
  • Thanks. But this is precisely what I am trying to avoid. My question states that I would like the computer to turn off directly after hitting the power button. This allows me to hit the power-off button and walk away as it works. Currently if I have a complete session loaded it takes a bit on my older computer to load the shutdown dialog prompt. I have to wait for it to load, and then press enter. I'm not habituated to it because with Xubuntu my family and I just hit the power button and it's done. Now we hit the power button and the computer stays on until someone catches it a few hours later – Rockishi Jan 6 '15 at 1:59
  • Well then, this works perfectly. You see, there is a way to do exactly what you wish, and I'm pretty sure that if one of us goes back far enough in my answers on this site we will see that another user worked out a way to avoid the dialogue screen at which I advised pressing enter. He apparently did this thinking that the drop down menu was annoying enough. As a consequence of my directing him to the power button shortcut, combined with his shutdown dialogue bypass, the end result was that tapping the power button sent the computer into an expedited shutdown. – gyropyge Jan 6 '15 at 2:11
0

See following bug with the same problem description:

https://bugs.launchpad.net/ubuntu/+source/lubuntu-default-settings/+bug/1319134

Workaroud: in /etc/acpi/powerbtn.sh, delete all but the last line:

/sbin/shutdown -h now "Power button pressed"

Maybe your system has exactly the same problem and this workaround will also work for you.

|improve this answer|||||
  • Hello, I tried your method, but unfortunately my Lubuntu 14.10 doesn't have the folder acpi inside /etc/. And a search for the term 'powerbtn' in /etc/ didn't reveal any results. – Rockishi Jan 13 '15 at 19:52
0

In the terminal type

sudo apt-get install acpid

Now reboot a few times. Worked for me. This took me 3 days of study.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.