[ubuntu-uk] Can I disable the power button?
Peter Lewis
prlewis at letterboxes.org
Mon Jun 18 13:55:37 BST 2007
On Monday 18 June 2007 at 13:43:46 Stuart.Houghton at amnesty.org.uk wrote:
> My one-year-old son has a new favourite game - pressing the power button
> on his Dad's PC.
Sounds like fun!
> I am running Gnome on Fiesty and whenever the power button is pressed it
> pops up a modal dialogue box asking if I want to restart, log out, switch
> off, etc. I assume this happens via Gnome Power Manager.
>
> What I would like is a way to disable this menu, so that hitting the power
> button either does nothing, or perhaps triggers a script that logs the
> number of times it has been pressed. The GPM settings dialogue only gives
> me the option of 'Ask Me', 'Shutdown' or 'Hibernate'.
>
> I have googled around the problem, but everything I have found seems to
> relate to laptops. Does a desktop system use ACPI as well?
If it's fairly modern, then "yes, probably" is the answer.
ACPI events seem to trigger a bunch of scripts in /etc/acpi
For example, there's an /etc/acpi/powerbtn.sh script, which claims that it
will run when the power button is triggered. If your read it, it basically
checks for GNOME / KDE / neither, then does the appropriate thing via the
desktop environment's power manager app.
It's a cheap hack, but I would start with:
sudo mv /etc/acpi/powerbtn.sh /etc/acpi/powerbtn.sh.orig
sudo ln -s /bin/false /etc/acpi/powerbtn.sh
Then give it a try. /bin/false does nothing at all, meaning that when the
power button is pressed, nothing will happen. If you want to revert, just
remove the symlink and the .orig suffix from the script.
Of course, you could presumably replace the script with something nice to keep
track of button presses, or output something to syslog...
Good luck!
Pete.
More information about the ubuntu-uk
mailing list