How do you run XBMC on nvidia dual screen and stop it from taking over the keyboard and mouse?

5,735

Solution 1

I was searching for the same.

I found you question first, but after searching a bit more I found a working answer and came back here to share.

The page that has the answer is located: http://blog.burlock.org/xbmc/77-fullscreen-xbmc-without-locking-the-mouse

A copy and paste of the basics:

First, you'll need to install a clever little application called "wmctrl", which permits us change certain window properties, such as hiding the border or making a window full-screen.

sudo apt-get install wmctrl

Next, you'll need the following script. I've called it "xbmc-fs" for obvious reasons. It's pretty self explanatory, so take a look at the comments. The only thing you might need to change is the fifth line where the display is selected. In my case, the TV is on display 1, so that's what I've set in the file. If yours is on display 0, then simply change the 1 to a 0 on line 5.

#! /bin/bash
# Launch XBMC in windowed mode, then use wmctrl to remove the titlebar

# Select display 1
DISPLAY=:0.1

# Start XBMC without blocking this script
xbmc &

# Wait for the XBMC window to appear
status=0
while [ $status -eq 0 ]
do
   sleep 1
   status=`wmctrl -x -l | grep "XBMC Media Center" | wc -l | awk '{print $1}'`
done

# Force XBMC window to fullscreen
wmctrl -x -r XBMC Media Center.XBMC Media Center -b toggle,fullscreen

The only other thing you'll have to do is make sure that you've set XBMC to the same resolution as the monitor/TV it will be displayed on, otherwise certain events can trigger the XMBC window to revert to the size that's set in it's configuration.

Solution 2

The above script is perfect; assuming the DISPLAY is correct for your setup. If it doesn't work for you, it's probably either the DISPLAY, or the final wmctrl line.

It wasn't working for me, but simplifying the line to the following did the trick:

wmctrl -r "XBMC Media Center" -b "toggle,fullscreen"
Share:
5,735

Related videos on Youtube

Eric Carvalho
Author by

Eric Carvalho

Updated on September 18, 2022

Comments

  • Eric Carvalho
    Eric Carvalho over 1 year

    I have set up dual screen under Ubuntu 12.04. I have a GeForce 8500 GT and have used the nVidia control panel to set up dual screen in "Separate screen mode". Here's the resulting xorg.conf:

    # nvidia-settings: X configuration file generated by nvidia-settings
    # nvidia-settings:  version 295.33  (buildd@zirconium)  Fri Mar 30 13:38:49 UTC 2012
    
    
    Section "ServerLayout"
        Identifier     "Layout0"
        Screen      0  "Screen0" 0 0
        Screen      1  "Screen1" RightOf "Screen0"
        InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "Mouse0" "CorePointer"
        Option         "Xinerama" "0"
    EndSection
    
    Section "Files"
    EndSection
    
    Section "InputDevice"
    
        # generated from default
        Identifier     "Mouse0"
        Driver         "mouse"
        Option         "Protocol" "auto"
        Option         "Device" "/dev/psaux"
        Option         "Emulate3Buttons" "no"
        Option         "ZAxisMapping" "4 5"
    EndSection
    
    Section "InputDevice"
    
        # generated from default
        Identifier     "Keyboard0"
        Driver         "kbd"
    EndSection
    
    Section "Monitor"
    
        # HorizSync source: edid, VertRefresh source: edid
        Identifier     "Monitor0"
        VendorName     "Unknown"
        ModelName      "Maxdata/Belinea B1925S1W"
        HorizSync       31.0 - 83.0
        VertRefresh     56.0 - 75.0
        Option         "DPMS"
    EndSection
    
    Section "Monitor"
    
        # HorizSync source: builtin, VertRefresh source: builtin
        Identifier     "Monitor1"
        VendorName     "Unknown"
        ModelName      "CRT-1"
        HorizSync       28.0 - 55.0
        VertRefresh     43.0 - 72.0
        Option         "DPMS"
    EndSection
    
    Section "Device"
        Identifier     "Device0"
        Driver         "nvidia"
        VendorName     "NVIDIA Corporation"
        BoardName      "GeForce 8500 GT"
        BusID          "PCI:1:0:0"
        Screen          0
    EndSection
    
    Section "Device"
        Identifier     "Device1"
        Driver         "nvidia"
        VendorName     "NVIDIA Corporation"
        BoardName      "GeForce 8500 GT"
        BusID          "PCI:1:0:0"
        Screen          1
    EndSection
    Section "Screen"
        Identifier     "Screen0"
        Device         "Device0"
        Monitor        "Monitor0"
        DefaultDepth    24
        Option         "TwinView" "0"
        Option         "metamodes" "CRT-0: nvidia-auto-select +0+0"
        SubSection     "Display"
            Depth       24
        EndSubSection
    EndSection
    
    Section "Screen"
    
    # Removed Option "metamodes" "CRT-1: 1280x768 +0+0"
        Identifier     "Screen1"
        Device         "Device1"
        Monitor        "Monitor1"
        DefaultDepth    24
        Option         "TwinView" "0"
        Option         "metamodes" "CRT-1: 1360x768_60 +0+0"
        SubSection     "Display"
            Depth       24
        EndSubSection
    EndSection
    

    All well and good and I have a nice blank XWindow displayed on my TV (the 2nd monitor). I then fire up XBMC from a terminal on the PC monitor using:

    DISPLAY=:0.1 xbmc
    

    XBMC fires up quite nicely on the TV however I can no longer use the main PC monitor/mouse/keyboard as XBMC on the TV screen seems to have focus. I was hoping to have XBMC running on the TV and let the kids use the MCE remote whilst I get on with my work on the PC monitor.

    Does anyone have any idea how to overcome this? I'm presuming there's some xorg.conf fun and games needed but I've no idea where to start to be honest.