Friday 26 October 2007

How to run apps that dont run on XGL desktop

You might encounter some apps that do not like XGL enabled desktop(for the less informed, aka Beryl, Compiz, Compiz-Fusion enabled desktops). Most often these are DirectX based Windows apps that you want to run through Wine or probably some Java App like Lazarus.

I found two different solutions with different approaches.

First approach:
Shift your present XGL enabled session into a separate Window and launch a nonXGL window manager on the main Xsession. I found this approach funny, but works.

Create this script and copy it to ~/bin for single user only or /usr/bin for global access. Give it a name like noxgl(u can change this to your liking)
#!/bin/sh

if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ $# -eq 0 ] ; then
echo "Usage : noxgl
[options]"
echo " noxgl -b
[options]"
echo " (-b option means 'border' so it adds a window border)"
exit
fi

if [ "$1" = "-b" ]; then
if [ -x /usr/bin/kwin ]; then
WM=kwin
else
WM=metacity
fi
DISPLAY=:0.0
$WM&
shift
$@
killall $WM
else
DISPLAY=:0.0 "$@"
fi


Now u can launch ur app as noxgl -b appname [options]

The second approach is to launch a nested Xserver using Xnest and launch ur app into the Xnest. You need to install Xnest for this.

Use the following commands:
Xnest -ac -terminate -geometry 1280x1024+0+0 :3 &

This will launch Xnest which is an Xserver as well as a Client.

Now launch ur app into this:
DISPLAY=:3 appname [options] &

A word of caution: By default Xnest will not allow Window borders, so it will be a hell to manage multiple windows(if your app uses them). So before launching ur app launch metacity using the above command and then launch ur app.

No comments: