Switching between XBMC and Fluxbox
#1
Lightbulb 
Hello,

I've been beating my head for 3 days trying to accomplish following scenario:
1. Press "Home" button on a remote (mapped to Keymap.xml to call shell script that closes XBMC and starts fluxbox)
2. Press Home again and it closes Fluxbox and starts XBMC Again

1. It works only if script is called via console, but if it's called via button "Home" it hangs with vertical lines on the screen
2. Works from both console and "Home" button on a remote

1. Script1.sh
#!/bin/sh
sudo /etc/init.d/xbmc stop
sleep 1
sudo cp /home/xbmc/.xsessionTV /home/xbmc/.xsession # (explanation bellow*)
startx

2. Script2.sh
#!/bin/sh
sudo killall -9 fluxbox
sleep 1
sudo /etc/init.d/xbmc start

3. callscript.py
#!/usr/bin/python
import os
os.system('sh /home/xbmc/.xbmc/Script1.sh')

Note that user xbmc is added to sudoers so it doesn't require password for sudo Rolleyes

*I am overwriting ./xsession with my own because I couldn't start fluxbox differently than via command startx
Once /etc/init.d/xbmc start is issued, it will overwrite ./xsession so I added my own with following commands:
firefox &
exec /usr/bin/fluxbox

Note that issuing /etc/init.d/xbmc start will return ./xsession to original state every time.

So script 1 work perfectly only if called from terminal
sh /home/XBMC/.xbmc/script1.sh

if executed from remote control it do
sudo /etc/init.d/xbmc stop
sudo cp /home/xbmc/.xsessionTV /home/xbmc/.xsession

and then hangs on
startx

Have no clue what could be the problem Huh

Any help on this matter is highly appreciated Smile

P.S. Different approach is also more than welcome, I'm aware that I complicated my life with this approach.
Maybe if Fluxbox can be run on top of XBMC is better solution.
Tried running firefox directly from XBMC but it wont allow me using mouse or keyboard and not whole screen was visible?...
Reply
#2
Bump Rolleyes

Anyone?

I'm buying a beer Laugh
Reply
#3
Check out this script I use to switch DPMS for my monitors on and off (Force Standby Mode.)
Code:
#!/bin/bash

if [ ! -f /tmp/dpms ];then
        echo 1 > /tmp/dpms
fi

if [ "$(cat /tmp/dpms)" == "0" ];then
        echo 1 > /tmp/dpms
        vbetool dpms on
else
        echo 0 > /tmp/dpms
        vbetool dpms off
fi

This script is very simple in the way that it works. If the file /tmp/dpms doesn't exist, then create it and put a 1 there.

Then I look at the contents of that file and if it's 0 then I put a 1 in there and turn DPMS ON (Turning my screens off.) If on the other hand there is for example a 1, then it turns DPMS OFF (Turning my screens on.) and puts a 0 instead. This logic creates a simple switch.

With this script I just assign it a key in KDE and with a single press I can switch my monitors in and out of standby mode.

You could use this and modify it slightly to run one routine when the file has a 1 and run another when the file has a 0. So, when 0, kill xbmc, run flux, when 1, kill flux, run xbmc.

With the current logic you'll always have to start with one application then switch if you wanted the other one, but it should work for your purposes.

Additionally xbmc doesn't need to run as root via sudo, it's best if it doesn't actually. Probably the same goes for fluxbox as well.

Also instead of replacing .xsession after xbmc has started, put your commands you would like to run in .xsessionrc in your home dir and it will run directly after .xsession. There will be no need to replace this file as the xbmc startup script does not erase it.
Reply
#4
Hi, thx for reply.

I will try this approach.

Cheers...
Reply
#5
\o/

I owe ya crate of beer mate Nod

I just modified my script to use .xsessionrc instead of .xsession and works like a charm.

Thx for the tips Wink
Reply
#6
I'm glad I could help. Smile I don't drink though. Wink
Reply
#7
Well,

how about crate of ice cream Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Switching between XBMC and Fluxbox0