[LINUX] Dual-Monitor Setup? Start XBMC on the second screen?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Gamogo Offline
Junior Member
Posts: 2
Joined: Jun 2009
Reputation: 0
Post: #11
Hi htpcero,

Sorry for the delayed reply - I've been pretty busy.

Your instructions worked perfectly. I had to do some minor xorg tweakery to get things right, but on the whole this helped me a bunch. The 'switchscreen' utility also made life a lot easier.

Thanks very much for sharing your approach to this problem.

- Gamogo
find quote
hieppo Offline
Junior Member
Posts: 2
Joined: Aug 2009
Reputation: 0
Post: #12
Hi htpcero,

Thanks for all your hard work. I was able to set it up so that I can play XBMC on the second monitor/desktop. However, I have one question.

Could you explain what the last 3 commands using switchscreen? There is no such utility in ubutu and the only one i google was the source code that I am not able to compile?

Is there any other trick to allow the use of the monitor/desktop that is not being used by XBMC?

Gamogo, could you tell me where you foudn switchscreen?

Thanks
find quote
htpcero Offline
Member
Posts: 82
Joined: May 2009
Reputation: 0
Post: #13
hieppo Wrote:Hi htpcero,

Thanks for all your hard work. I was able to set it up so that I can play XBMC on the second monitor/desktop. However, I have one question.

Could you explain what the last 3 commands using switchscreen? There is no such utility in ubutu and the only one i google was the source code that I am not able to compile?

Is there any other trick to allow the use of the monitor/desktop that is not being used by XBMC?

Gamogo, could you tell me where you foudn switchscreen?

Thanks

swtichscreen is a small utility that someone wrote specifically to allow scripts to force moving the mouse across different screens; it is described in this post:

http://forum.xbmc.org/showpost.php?p=187906&postcount=8

and this is the link to the sourcecode: http://sampo.kapsi.fi/switchscreen/
compiling it is trivial - follow the instructions in the README file.
find quote
htpcero Offline
Member
Posts: 82
Joined: May 2009
Reputation: 0
Post: #14
htpcero Wrote:After trying different things for a couple of weeks I found a setup I can live with. I'll describe it below, my recommendation is -only try it if you are ready to spend time tuning your config, and you feel you are a somewhat skilled linux geek

1.) What is your graphics hardware?
nvidia 8600

2.) Do each of your screens have different resolutions?
yes, lcd 1920x1200, tv 1920x1080

3.) When XBMC runs at full screen on one screen, does it not 'center' itself between the two?
no

I'm using ubuntu 9.04. Assume this is for 32-bits. I'm actually using 64-bits and that was another source of pain, but that is not relevant in this thread.

What I did is: I configured manually in xorg.conf two different screens, without using twinview (which I used in the past for several years).

Here's my xorg.conf:

Code:
# xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "Files"
EndSection

# commented out by update-manager, HAL is now used
#Section "InputDevice"
#    Identifier    "Generic Keyboard"
#    Driver        "kbd"
#    Option        "CoreKeyboard"
#    Option        "XkbRules"    "xorg"
#    Option        "XkbModel"    "pc105"
#    Option        "XkbLayout"    "us"
#EndSection

# commented out by update-manager, HAL is now used
#Section "InputDevice"
#    Identifier    "Configured Mouse"        
#    Option "Protocol" "Auto"
#    Driver "mouse"        #OJO: evdev ya no se usa en Hardy
#    Option "Name" "Logitech USB Gaming Mouse"
#    Option "CorePointer"
#    Option "SendCoreEvents"
#    Option "Buttons" "8"
#    Option "ZAxisMapping" "4 5 7 8"
#    Option "Emulate3Buttons" "false"
#EndSection

Section "Device"
    Identifier     "nvidia0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8600 GT"
    BusID          "PCI:1:0:0"
    Screen          0
    Option         "AddARGBGLXVisuals" "True"
    Option         "AllowGLXWithComposite" "true"
    Option         "RenderAccel"
    Option         "NoLogo" "True"
EndSection

Section "Device"
    Identifier     "nvidia1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8600 GT"
    BusID          "PCI:1:0:0"
    Screen          1
    Option         "AddARGBGLXVisuals" "True"
    Option         "AllowGLXWithComposite" "true"
    Option         "RenderAccel"
    Option         "NoLogo" "True"
EndSection



Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "BenQ G2400W"
    HorizSync       31.0 - 94.0
    VertRefresh     50.0 - 85.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "SHARP HDMI"
    HorizSync       15.0 - 75.0
    VertRefresh     23.0 - 76.0
    Option         "DPMS"
EndSection



Section "Screen"
    Identifier     "Screen0"
    Device         "nvidia0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "metamodes" "DFP-0: 1920x1200 +0+0"
    SubSection     "Display"
        Modes      "1920x1200"
    EndSubSection
EndSection


Section "Screen"
    Identifier     "Screen1"
    Device         "nvidia1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "metamodes" "DFP-1: 1920x1080 +0+0"
    SubSection     "Display"
        Modes      "1920x1080"
    EndSubSection
EndSection


Section "ServerLayout"
    Identifier     "Default Layout"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
EndSection


Section "Module"
    Load           "i2c"
    Load           "bitmap"
    Load           "ddc"
    Load           "extmod"
    Load           "freetype"
    Load           "glx"
    Load           "int10"
    Load           "type1"
    Load           "vbe"
EndSection

Section "Extensions"
    Option        "Composite"    "Enable"
EndSection


The I tweaked compiz so that I doesn't load on the TV screen. I still run compiz in the LCD monitor, but I run openbox (a simpler, faster, window manager), xbmc had problems with compiz 3d effects (and xbmc doesn't need compiz effects, it has its own).

Code:
sudo apt-get install openbox

Code:
sudo gedit /usr/bin/compiz

modify the line that reads:

          COMPIZ_OPTIONS="--ignore-desktop-hints --replace"

and make it look like this:

COMPIZ_OPTIONS="--ignore-desktop-hints --replace --only-current-screen"

After a reboot, execute this in a terminal:
Code:
DISPLAY=:0.1 openbox --replace &

Compiz should be working fine in your computer minitor (assumed to be DISPLAY=:0.0) and you should have openbox in your TV (DISPLAY=:0.1). To get from one screen to another, you can use the mouse. You can not move windows across though.

You can have openbox auto-executed when you log in by adding the line above to System > Preferences > Startup Applications

Next, you can remove the bottom gnome-panel from your TV screen, and the top one you can make either transparent and auto-hide, or you can try removing it too (I had problems, I couldn't remove it)

Now, try launching XBMC like this:

DISPLAY=":0.1" xbmc -fs


If you still want to use your desktop mouse and keyboard on the computer monitor, simultaneously with xbmc, you can use the "wmctrl" hack described in this thread, and for some reason I also had to use the "switchscreen" utility. Here's my launch script:

Code:
#! /bin/bash
# runs xbmc in a normal window, in Screen 1 (TV)
# then it brings it up to full screen
# this is to avoid xbmc trapping the mouse



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


# disable screensaver
gnome-screensaver-command -i &


/usr/bin/xbmc &

using togglescreen
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 &


#displace mouse pointer to the edge before switching screens
/home/htpcero/Desktop/htpcero/Linux/Switchscreen/switchscreen -c 0,1079 1

sleep 3
DISPLAY=:0.0 /home/htpcero/Desktop/htpcero/Linux/Switchscreen/switchscreen -c 0,0 0
sleep 3
DISPLAY=:0.0 /home/htpcero/Desktop/htpcero/Linux/Switchscreen/switchscreen -c 0,0 0


Good luck Smile


For those brave souls that installed XBMC on Ubuntu Lucid/10.04 fresh-install in a dual-screen desktop+TV install, and were wondering what happened with the olden-times /usr/bin/compiz "shell script" that ubuntu used to use - that script does not exist any more in Lucid.

The nicest way I found to add the "--only-current-screen" startup option to compiz (without resorting to ugly ad-hoc scripts) in 10.04+ is as follows:

sudo gedit /usr/share/applications/compiz.desktop

replace the exec line ("Exec=compiz") with:
Code:
Exec=compiz --only-current-screen

The rest of the stuff is still working fine in Lucid - including screenswitcher and of course XBMC. Currently running Compiz on my LCD/Desktop, and Openbox on my TV hdmi output. Initially I just ran the default compiz in both LCD/desktop and TV however I noticed that all video (VDPAU and non-VDPAU) was showing a strange "tear" line in the middle of the TV display. Problem solved by running openbox on the TV screen.
(This post was last modified: 2010-06-17 04:44 by htpcero.)
find quote
odt_x Online
Senior Member
Posts: 158
Joined: Jun 2010
Reputation: 1
Post: #15
htpcero Wrote:For those brave souls that installed XBMC on Ubuntu Lucid/10.04 fresh-install in a dual-screen desktop+TV install, and were wondering what happened with the olden-times /usr/bin/compiz "shell script" that ubuntu used to use - that script does not exist any more in Lucid.

The nicest way I found to add the "--only-current-screen" startup option to compiz (without resorting to ugly ad-hoc scripts) in 10.04+ is as follows:

sudo gedit /usr/share/applications/compiz.desktop

replace the exec line ("Exec=compiz") with:
Code:
Exec=compiz --only-current-screen

The rest of the stuff is still working fine in Lucid - including screenswitcher and of course XBMC. Currently running Compiz on my LCD/Desktop, and Openbox on my TV hdmi output. Initially I just ran the default compiz in both LCD/desktop and TV however I noticed that all video (VDPAU and non-VDPAU) was showing a strange "tear" line in the middle of the TV display. Problem solved by running openbox on the TV screen.


Thanks! That's exactly the kind of information I was looking for yesterday, ie. where to put the --only-current-screen. Anyway, I had to do couple more things to get it work properly:

1) gconf-editor and change key /desktop/gnome/session/required_components/windowmanager=compiz
2) in /usr/share/applications/compiz.desktop also specify --display :0.0

Now I can see that the second display has no WM indeed. What options are there now to get rid of some more stuff on that display, ie. gnome panels/desktop backgrounds etc?
(This post was last modified: 2010-06-17 10:26 by odt_x.)
find quote
htpcero Offline
Member
Posts: 82
Joined: May 2009
Reputation: 0
Post: #16
odt_x Wrote:Thanks! That's exactly the kind of information I was looking for yesterday, ie. where to put the --only-current-screen. Anyway, I had to do couple more things to get it work properly:

1) gconf-editor and change key /desktop/gnome/session/required_components/windowmanager=compiz
2) in /usr/share/applications/compiz.desktop also specify --display :0.0

Now I can see that the second display has no WM indeed. What options are there now to get rid of some more stuff on that display, ie. gnome panels/desktop backgrounds etc?


In my case, I deleted the bottom panel and moved the application list to the top panel, then I made the top panel auto-hide.

I launch xbmc with my own startup script that launches it in windowed mode, then uses wmctrl to maximize it. All this takes a fraction of a second on my desktop (using an ssd drive for the OS and apps)

The background image in the second is the same as in the first, this seems to be a gnome limitation (not sure), however since I run xbmc on startup in that screen - maximized, the background does not bother me, since it is not visible.
find quote
fab31 Offline
Junior Member
Posts: 3
Joined: Jul 2010
Reputation: 0
Post: #17
Here is my solution for displaying XBMC on secondary monitor without mouse stealing.

My two screens are :
- Left: an LCD monitor (1920x1600).
- Right: an Sony TV (1360x768).

I configured the two monitors in nvidia drivers as twinview. So, the X server has a résolution of 3280x1600.

I simply use devilspie to move XBMC windows on the secondary screen and remove windows decorations.

Here is the devilspie configuration file (~/.devilspie/xbmc.ds) :

Code:
(if
  (contains (application_name) "xbmc.bin")
  (begin
    (undecorate)
    (stick)
    (wintype "dock")
    (geometry "1360x768+1920+0")
  )
)

The geometry statement means that the windows is resized to 1360x768 (the secondary monitor resolution) and move to 1920x0 coordinates, just at the right of the primary monitor.
Of course, I'll maybe have to customize these values depending on your monitors setup.

And here is the XBMC launcher

Code:
#! /bin/bash

devilspie &

export SDL_AUDIODRIVER=dsp
export XBMC_AUDIODEV=spdif
/usr/bin/xbmc "$@"

killall devilspie

It works like a charm ! Wink

Hope this helps.
(This post was last modified: 2010-07-12 14:27 by fab31.)
find quote
DoctorDyna Offline
Senior Member
Posts: 116
Joined: Oct 2010
Reputation: 4
Post: #18
Hey guys, gonna have to dig this one up again.

So, I've managed to get this working properly, with one minor caveat that I'd like to fix. It doesn't work with compiz. I'm running Mint 14. If I use the shell script it launches xbmc on the tv and gives me the mouse and keyboard back, however if I change from "Marco" to "Compiz" the script starts complaining about "winclass" and loops over and over.

Anyone have any idea?
find quote
Post Reply