Fullscreen XBMC on one monitor, usable mouse/keyboard on another.
#1
Lightbulb 
I posted this over at boxee.tv, and thought it might have some value here, too.
This is entirely my own hack, but it's fairly obvious. Please accept my apology in advance, if it's been posted.
----------------------------------------------------------------------------------------------------------------------------
*THIS IS A COMPLETE HACK*

in fullscreen mode, XBMC locks the mouse/keyboard to it's window.
as a result, you can not launch XBMC fullscreen on one monitor, and still use your mouse/keyboard on another. Sad

this is an issue with the sdl frameword that boxee/xbmc are based on, and not something that is easily fixed the those teams.

so here's what you can do:

1. install wmctrl.
click here on ubuntu.

2. configure boxee to launch in windowed mode.
in boxee: Settings > Appearance > Screen > Resolution.
set it to anything that ends in: "(Window)"

3. use wmctrl to make boxee fullscreen.
wmctrl -x -r xbmc.bin.xbmc.bin -b toggle,fullscreen

BAM! fullscreen XBMC, completely usable mouse/keyboard.

now, this is all fine and good, but I want to launch XBMC like this.

here is a simple shell script:
Code:
#! /bin/bash

STATUS=0
WINCLASS=xbmc.bin.xbmc.bin
DISPLAY=:0.1
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
save this as ~/bin/launch-xbmc

then run this command:
chmod +x ~/bin/launch-xbmc
-------------------------------------------------------------------------------------------------------------------

note: set "DISPLAY" to whichever display you want XBMC to run on.

note: you may need to adjust "SLEEPDELAY" to be longer or shorter, depending on your system.

confession: i suck at scripting, so if i did something dumb, lemme know.
Reply
#2
Fixed your typo and deleted the extra post for clarity Wink
Reply
#3
I just had this problem pop up on me over the weekend and was completely stymied by it. I cannot believe that I just happen to drop in on the forum and voila, here's a fix.

My setup involves a theater projector as primary monitor and a secondary 1024x768 touchscreen monitor. Since I cannot do a scaled clone of the XBMC GUI (nVidia does not support scaling in TwinView mode), I have them set up as separate X screens. I have my startup script modified to send XBMC to the projector and Firefox 3.0 to the small screen. I have Firefox set to full screen and intend on using the XBMC web server (probably the AJAX version) to control XBMC without having to turn on the projector.

Obviously, when it boots up everything looks good (XBMC on projector and small monitor has the web interface), but the touchsreen does not work (or the mouse or keyboard). I even disabled the mouse in XBMC, thinking that might free it up for the other screen, but no dice.

Thanks for the quick tutorial. I'll give this a whirl over Labor Day weekend and report back if I have any issues.
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#4
Woah, I just googled wmctrl and it talks about using it to "take control of your window manager." Can you use this without a window manager installed? I am running all this from a USB stick-based command line only install.
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#5
Yeah, you need to be running a WM, and one that supports Windowing Hints (EWMH)

BUT, I think another soution for you would be to run Awesome as your WM. It doesn't support EWMH, so you can't use this hack, but anything you launch is made automatically fullscreen.

So if you set boxee to run in windowed mode, then launch it on a given screen, it will be stretched fullscreen.

http://awesome.naquadah.org/

Check it out, it's VERY minimal. When I use it, it's xterm fullscreen on on monitor, and boxee or mythTV fullscreen on the other. Simple.
Reply
#6
Damned no edit button!

Also, if you run Ubuntu, DO NOT use the version in the Ubuntu repos. It's old and has some bugs around viewpoint switching on multi-mon setups.
Reply
#7
I'm worried about space on my USB stick, what with XBMC, then Firefox and now this... it is only a 2GB!
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#8
agentlame Wrote:Yeah, you need to be running a WM, and one that supports Windowing Hints (EWMH)

BUT, I think another soution for you would be to run Awesome as your WM. It doesn't support EWMH, so you can't use this hack, but anything you launch is made automatically fullscreen.

So if you set boxee to run in windowed mode, then launch it on a given screen, it will be stretched fullscreen.

http://awesome.naquadah.org/

Check it out, it's VERY minimal. When I use it, it's xterm fullscreen on on monitor, and boxee or mythTV fullscreen on the other. Simple.

So, just to clarify, on a 1080p projector, what would I set XBMC to run at? It seems like it I set it at 1080p, it will already be full screen. I don't want to have to set it at, say, 720p and have it stretched to 1080p -- that would be ugly.

Seems like there should be a better way to do this -- is there any way to -- within XBMC -- have it not seize control of the mouse/keyboard?
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#9
Can you clarify "not running a window manager"?

Is it just a straight x session? Can you even do that?
Also, what are you plugging the usb stick into?
What distro is the usb stick running? Is it LFS with just the kernel, x, XBMC, and FF?

As far as size goes, AwesomeWM is a couple megs, at best. It's BARELY a window manager.
Reply
#10
agentlame Wrote:Can you clarify "not running a window manager"?

Is it just a straight x session? Can you even do that?
Also, what are you plugging the usb stick into?
What distro is the usb stick running? Is it LFS with just the kernel, x, XBMC, and FF?

As far as size goes, AwesomeWM is a couple megs, at best. It's BARELY a window manager.

Just a Hardy command-line only install. I then installed things like openssh (for ssh and sftp access to the box), lirc, x, and xbmc. And Firefox (for control via the second monitor).

USB stick is plugged into USB in on PC and mobo is set to boot from USB. Takes about 45 seconds to boot into XBMC.

Cannot remember what else but I typed it all up somewhere if you're interested (in case I need to do it again). Let me know and I will be happy to dig it up and PM it to you.

I'll think about giving awesome a try. Just wish there was some other way of doing this. Sure is a lot of work just to get XBMC set up this way (would be great if XBMC would just add Xinerama support or nVidia would support scaled cloning).
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#11
Check out this thread:

http://forum.xbmc.org/showthread.php?tid=32046
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#12
Well, damn I guess you can run it without a WM.

But if there is no WM, and you set XMBC to run windowed, wouldn't it just take up the full screen, regardless?

I would try setting XBMC to something that ends in "(window)" and see if it consumes the entire screen.

Also, I shouldn't have said XBMC stretches, wrong word. It's scales. It will correctly scale to what ever size you change the window to.
Reply
#13
agentlame Wrote:Well, damn I guess you can run it without a WM.

But if there is no WM, and you set XBMC to run windowed, wouldn't it just take up the full screen, regardless?

I would try setting XBMC to something that ends in "(window)" and see if it consumes the entire screen.

Also, I shouldn't have said XBMC stretches, wrong word. It's scales. It will correctly scale to what ever size you change the window to.

It doesn't. It takes up the applicable portion of the screen. So, for instance, at 720p, it does not take up the full screen.

I'll play with all this a bit as soon as I can. Although I have to say, I would think that an easy fix could be worked into XBMC for those of us that have two monitors (something that enables us to disable the seizing of the keyboard and mouse).
Supporter of all things Linux, Android, XBMC and NextPVR
Reply
#14
I could be wrong about the details, but I don't think it's a simple fix.

My understanding is SDL is a cross-platform gaming framework, and that's why FS locks the mouse. Which is the right way to do it--for games.

ioquake does NOT handle FS on multi-mon correctly, so when I play WoP, if my mouse ventures to the other screen, WoP resizes and becomes windowed. Pisses me off.

But, like I said, I might be misunderstanding the exact implementation details.
Reply
#15
agentlame Wrote:I could be wrong about the details, but I don't think it's a simple fix.
I was curious about this, so I tried to create a simple SDL application exhibiting the fullscreen-mouse-grabbing behavior. Turns out it happens whenever you set the video mode to fullscreen, so I would say it really is a limitation of SDL, and the only way around it is changing SDL.

Here's the code I used if anyone is curious. Note that most of the code has to do with making q and Esc quit the demo and printing error messages if something goes wrong. The only relevent line is really the call to SDL_SetVideoMode with the SDL_FULLSCREEN flag.

If someone submitted a patch to SDL with a non-mouse grabbing fullscreen mode, that would be awesome, but I have no idea how complicated this would be.

Code:
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    SDL_Surface *screen;
    if(SDL_Init(SDL_INIT_VIDEO) != 0)
    {
        printf("SDL Init failed: %s", SDL_GetError());
        return 1;
    }

    atexit(SDL_Quit);

    screen = SDL_SetVideoMode(1600, 1200, 16, SDL_FULLSCREEN);
    if(screen == NULL)
    {
        printf("Setting video mode failed: %s", SDL_GetError());
        return 1;
    }

    SDL_Event event;
    int quitFlag = 0;

    while(quitFlag == 0)
    {
        while(SDL_PollEvent(&event))
        {
            if(event.type == SDL_KEYDOWN
               && (event.key.keysym.sym == SDLK_q
                   || event.key.keysym.sym == SDLK_ESCAPE))
            {
                quitFlag = 1;
            }
        }
    }
}
Reply

Logout Mark Read Team Forum Stats Members Help
Fullscreen XBMC on one monitor, usable mouse/keyboard on another.1