rss
twitter
    Find out what I'm doing on Twitter

Howto Automatically Disable Compiz When Launching Games

When launching OpenGL games, google-earth etc you sometimes need to disable compiz.Most of you probably use fusion-icon or similar applications instead of enabling/disabling compiz via terminal.Today i will introduce you a very simple script to automatically disable compiz when launching applications/games, it will also restore the compiz after exiting the application.Unfortunately it is for Gnome only.All credits go to Amof from ubuntuforums.

Create an empty file called "game" under /usr/bin/ , via touch command and make it executable :

$sudo touch /usr/bin/game && sudo chmod +x /usr/bin/game

Open it via gedit or your favorite editor and paste the following :

$sudo gedit /usr/bin/game

#!/bin/bash

COMP="false";
if ps -A | grep compiz > /dev/null ; then
echo "Warning: Compiz Detected!!!"
metacity --replace > /dev/null &
COMP="true"
fi
echo "Starting"
$1
echo "Finish"
if $COMP ; then
echo "Warning: Starting Compiz!!!"
compiz --replace > /dev/null &
fi
exit


Save and exit.

Now you can just type game before before your application/game command.Example :

$game eternallands
$game wesnoth

2 comments:

mahmood-188 said...

wow ! it work really great.
I tried it with "urban terror". but when I closed the game the X server closed then it brought me to GDM !!

so I deleted the "exit" from the end of "game" script and now after closing the any game, it re-initiate compiz without restarting the X server :)

i'm on Intrepid 8.10, maybe Jaunty is different .. I dont know o_O

regards,
MaXo..

Carl said...

This is great! thanks =]

Post a Comment