7

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.

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

3 Answers 3

5

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.

2
  • I cannot find xfce4-power-manager.xml :(
    – Weboide
    Jul 30, 2010 at 1:19
  • I believe the usual location is $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
    – jbowtie
    Jul 30, 2010 at 22:07
5

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
2

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.

1
  • 2
    That page asks to sign in :( Isn't it possible to copy the contents here?
    – Joril
    Nov 16, 2011 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .