5

Since I run XBMC as a program, and not standalone, I would just like it to exit when I click the power button. The default behavior is to show the shutdown menu, and I don't want to accidently shut down my computer.

Gerhard Burger
  • 9,359
  • 5
  • 41
  • 59

1 Answers1

7

Remap the Power button on the home screen to quit xbmc instead of showing the shutdown menu:
You should modify the Home.xml file in your skin folder in /usr/share/xbmc. For me (Frodo RC3 with the Confluence skin) this is /usr/share/xbmc/addons/skin.confluence/720p/Home.xml.

In this file you need to replace the line (in my case line 1067, see bottom of the post on how to quickly open the file at that position)

<onclick>ActivateWindow(ShutdownMenu)</onclick>

by

<onclick>XBMC.Quit()</onclick>

Now if you click the power button in XBMC it should just exit, without showing a menu.
You need to do this again after XBMC updates since it overwrites the files in /usr/share/xbmc.


Alternatives / Notes
With the above solution you can still shutdown XBMC using a remote, or the web interface.

Instead of doing the above (simply quiting, not showing the shutdown menu) you can also edit the shutdown menu instead. The menu itself is in /usr/share/xbmc/addons/skin.confluence/720p/DialogButtonMenu.xml. The interesting menu buttons are defined from line 73 and down. The shutdown button (id=3) has the property

<visible>System.CanPowerDown</visible>

changing this to

<visible>no</visible>

should hide it from the menu. You can do the same trick for suspend, reboot, etc.

This still doesn't prevent shutting down from the webinterface I think, If only I knew how to set System.CanPowerDown=false...
If you know it please add it in the comments.


Extra: Commands to quickly open the file at the right position (1067,33)

  • Vim (If you don't know it, try to learn it, it is very nice!)

    sudo vim /usr/share/xbmc/addons/skin.confluence/720p/Home.xml +1067
    

    or even better (independent of actual line number)

    sudo vim /usr/share/xbmc/addons/skin.confluence/720p/Home.xml +/ShutdownMenu
    
  • Nano (terminal editor that is easy to use for beginners)

    sudo nano +1067,33 /usr/share/xbmc/addons/skin.confluence/720p/Home.xml
    
  • Gedit (Simple GUI editor)

    gksudo gedit /usr/share/xbmc/addons/skin.confluence/720p/Home.xml +1067
    
Gerhard Burger
  • 9,359
  • 5
  • 41
  • 59
  • Yeah!. I thought this was not possible. Can you also add the following so it is easier to go to it: sudo nano +1067,33 /usr/share/xbmc/addons/skin.confluence/720p/Home.xml Or sudo gedit +1067 /usr/share/xbmc/addons/skin.confluence/720p/Home.xml – Luis Alvarado Jan 08 '13 at 00:50
  • 1
    @LuisAlvarado: Thanks, I edited the answer, I think I will contact someone from the xbmc community to see how I can set `System.CanPowerDown=false`. That would be a nice alternative. – Gerhard Burger Jan 08 '13 at 08:31
  • Yes it will. It will save me and I think everybody I know that uses XBMC a headache or two. – Luis Alvarado Jan 08 '13 at 11:08
  • 1
    On the xmbc irc they thought it was not possible, they suggested to run xbmc as user without shutdown/suspend privileges. I thought that was too much trouble. Instead I made I feature request: http://forum.xbmc.org/showthread.php?tid=151278&pid=1290873#pid1290873 – Gerhard Burger Jan 10 '13 at 10:03