Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Xubuntu Lucid 10.04 computer plugged in to my TV. I use the command line to administrate it.

Right now when I hit the power button it just opens a Logout screen.

How can I set it up so that I can shut it down by hitting the power button? I know it has something to do with acpi or acpid.

I want answers to be command-line only as I do not have any keyboard or mouse connected to that computer.


Edit:

Isn't there a way to modify the default behavior of the xfce4 power manager when pushing the power button?

Also instead of using the GUI to do so, can I do it by creating/modifying a configuration file?

jbowtie had an interesting answer but I cannot find the xfce4-power-manager.xml file. If someone knows where to find that file or how to create it, I would be interested.

share|improve this question
    
Doesn't the logout screen time out automatically? –  txwikinger Jul 30 '10 at 0:49
    
No, there is no time out. –  Weboide Jul 30 '10 at 1:16
    
Why can't you just edit /etc/acpi/powerbtn.sh as mentioned in my answer? –  Nathan Osman Jul 30 '10 at 22:25
    
Would this file be replaced by an upgrade? –  Weboide Jul 31 '10 at 0:54

3 Answers 3

When you hit the power button, the script /etc/acpi/powerbtn.sh is called. So one option is to modify this script to just call the shutdown script, bypassing the power management daemon. This works across all distributions and environments that I know of.

Since you're using Xubuntu, you can however just change the setting 'power-switch-action' in xfce4-power-manager.xml to the shutdown action - the default value is the ask action.

share|improve this answer
    
I cannot find xfce4-power-manager.xml :( –  Weboide Jul 30 '10 at 1:19
    
I believe the usual location is $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml –  jbowtie Jul 30 '10 at 22:07
up vote 3 down vote accepted

I found a solution. jbowtie put me on the right tracks. Kudos to him.

The problem was I did not have any xfce4-power-manager.xml file and I did not know exactly where to find the file and how to modify the file, but I found that I needed to copy the file from /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml and use xfconf-query to modify it properly.

The shutdown action for /xfce4-power-manager/power-button-action seemed to be 4.

Here's what I did:

cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml $HOME/.config/xfce4/xfconf/xfce-perchannel-xml
DISPLAY=:0.0 xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/power-button-action -s 4
share|improve this answer

You are indeed right about ACPI.

This forum post is exactly what you're looking for.

It details the steps you need to take far better than I ever could explain it :)

Edit: Basically, the solution was to install acpid.

share|improve this answer
2  
That page asks to sign in :( Isn't it possible to copy the contents here? –  Joril Nov 16 '11 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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