Full-screen XBMC without locking the mouse E-mail
Thursday, 06 August 2009 08:40

I originally setup XBMC with multiple screens, so that I could watch a video and periodically check my email. Unfortunately, due to the design of XBMC, running it in full screen mode locks the mouse into it's window which means that the other desktop simply isn't accessible. The alternative is to run it windowed, but even with the window maximised, the title bar is still visible, so neither option is suitable.

Here's how to fix this little problem.

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.

So there you have it, you should now have XBMC running perfectly on your second monitor or TV, while you work on your primary one. Don't forget to enable VDPAU if you've got a recent nVidia card, so that your activity on the primary desktop doesn't cause the video to stutter or drop frames... unless you're trying to play Crysis at the same time, in which case you're on your own!

blog comments powered by Disqus