1

How can I detect when the user has pressed the power off button?

view story
linux-howto

http://stackoverflow.com – I have an arcade cocktail cabinet (no keyboard, just a joystick and buttons) running Ubuntu 12.4.1, when the power button is pressed a popup appears and the system shuts down fine, but when my full-screen game launcher menu application is running then pressing the button has no effect. I would like to trap the event when the button is pressed so my app can trigger the system shutdown. My menu app is written in c++ and is using SDL. Any ideas on how I can trap the power off button press event? Thanks to those that responded, here is the actual code I used to get it to work: Class members: in (HowTos)