When launching OpenGL applications 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.
Lets introduce you a very simple script I found (via google of course) to automatically disable compiz when launching your applications/games. It will also restore the compiz after exiting the application.
Create an empty file called “game” under /usr/bin/
To make the file copy+paste the following line in your terminal window:
sudo gedit /usr/bin/game
Copy and paste the following text into the file:
#!/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
Then save and close the file.
To touch and make the file executable copy+paste the following line:
sudo touch /usr/bin/game && sudo chmod +x /usr/bin/game
Now you can just type game before before your application/game command.Example :
$game eternallands
$game wesnoth
on the first step when I try to create the ‘game’ folder in the bin directory. I get a permission error that doesn’t allow me to create it.
You need to make a new text file … i added a line that will make the file the easy way. Copy+paste the following line in your terminal window:
sudo gedit /usr/bin/game
When done save and close the file …