Twinview - control which display XBMC is launched in
#1
I'm using XBMC on Ubuntu 10.04 with Compiz. I have a plasma with 1280x720 resolution and a good old projector with 800x600. Using Nvidia & twinview with HDMI to the plasma and component to the projector.

To start XBMC in fullscreen and still be able to use the second screen I'm using this script:

Code:
#! /bin/bash

STATUS=0
WINCLASS=xbmc.bin.xbmc.bin
DISPLAY=:0.0
SLEEPDELAY=1


/usr/bin/xbmc "$@" &

while [ $STATUS -eq 0 ]
do
  sleep $SLEEPDELAY
  STATUS=`wmctrl -x -l | grep $WINCLASS | wc -l | awk '{print $1}'`
done

wmctrl -x -r $WINCLASS -b toggle,fullscreen
The problem
I want to be able to control on which display (plasma/projector) XBMC is launched. Changing DISPLAY to 0.1 has no effect (since I'm using twinview I guess). XBMC is always launched on my primary display (the plasma).

I can work around this by dragging a terminal window on the secondary display and run the launch script from there. Not very pretty...

Ideally, I want to start the projector and the htpc and have XBMC launch on the projector since the plasma is turned off. And vice versa. But I'll be happy with two separate script for the two displays.

Thankful for any clues that'll point me in the right direction!
Reply
#2
Can't you just move the window to the right position? Other than Xinerama, Twinview AFAIK treats all monitors as one screen. So you should be able to move the window wherever you want.

Let's say the Plasma is the left screen and the projector the right one:
Code:
## move to plasma (left)
wmctrl -x -r $WINCLASS -e 0,0,0,1280,720

## move back to projector (right)
wmctrl -x -r $WINCLASS -e 0,1280,0,800,600

If that does not work, you could just use Xinerama. With Xinerama DISPLAY=:0.1 should work.
Reply
#3
Spot on Temar! Should have read the docs on wmctrl a bit better I guess. Now I can bind keyboard shortcuts to 2 different scripts, one four the plasma and one for the projector.

But...

Currently I'm having XBMC autostarting with Ubuntu. Is there someway to detect that one of the displays is turned off and launch XBMC on the display that's running?

Typical scenario is that you switch on only the projector along with the HTPC. Do I have to give up on twinview to accomplish something like that?
Reply
#4
sackerud Wrote:Currently I'm having XBMC autostarting with Ubuntu. Is there someway to detect that one of the displays is turned off and launch XBMC on the display that's running?

Typical scenario is that you switch on only the projector along with the HTPC. Do I have to give up on twinview to accomplish something like that?

You might be able to do this using 'nvidia-settings'. You can save different monitor configurations and load these configurations on the fly from the command line. You might also be able to determine which monitor is on by querying the displays using "nvidia-settings --query all".
Reply
#5
Good stuff Temar! I'll give nvidia-settings a shot. Maybe I'll come up with something clever so I can share it.

Currently using windowsbtn+x and windowsbtn+p for launching XBMC on plasma/projector. I can live with that.

Thanks a million Temar!
Reply

Logout Mark Read Team Forum Stats Members Help
Twinview - control which display XBMC is launched in0