ad_267
July 23rd, 2008, 12:49 AM
I have problems running full screen games with compiz (games will be randomly minimized and I lose control) so I wrote this script. It's pretty basic but I still thought it might be useful for someone else. All it does is runs "metacity --replace," executes the commands given to it and then runs "compiz --replace."
Installation:
Open a terminal and enter:
gksu gedit /usr/games/playgame
I put mine in /usr/games but it can be anywhere in your path, eg /usr/bin or ~/bin
Enter:
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: playgame game_name game_options" 1>&2
exit
fi
# Replace compiz with metacity to prevent issues
metacity --replace &
# Run game
$@
# Replace metacity with compiz
compiz --replace
Save that and close gedit then in the terminal enter:
sudo chmod +x /usr/games/playgame
Now run alacarte or right click on your menu and select edit menus. Find the launchers for any games you want to use this with and right click and select properties. Where it says "Command:," keep the same command but just put "playgame " in front (without the quotes and with a space after). Eg to play alien arena, the command is "alienarena" which I changed to "playgame alienarena"
Now compiz will be replaced with metacity while you play these games.
Known Issues:
Metacity and compiz handle workspaces differently so if you have a lot of applications spread out on different workspaces and run this they will end up all on the first workspace.
Note:
Don't run "playgame game_name" in a terminal as when you close the terminal this will cause compiz to exit and you will lose your window borders and window management.
Installation:
Open a terminal and enter:
gksu gedit /usr/games/playgame
I put mine in /usr/games but it can be anywhere in your path, eg /usr/bin or ~/bin
Enter:
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: playgame game_name game_options" 1>&2
exit
fi
# Replace compiz with metacity to prevent issues
metacity --replace &
# Run game
$@
# Replace metacity with compiz
compiz --replace
Save that and close gedit then in the terminal enter:
sudo chmod +x /usr/games/playgame
Now run alacarte or right click on your menu and select edit menus. Find the launchers for any games you want to use this with and right click and select properties. Where it says "Command:," keep the same command but just put "playgame " in front (without the quotes and with a space after). Eg to play alien arena, the command is "alienarena" which I changed to "playgame alienarena"
Now compiz will be replaced with metacity while you play these games.
Known Issues:
Metacity and compiz handle workspaces differently so if you have a lot of applications spread out on different workspaces and run this they will end up all on the first workspace.
Note:
Don't run "playgame game_name" in a terminal as when you close the terminal this will cause compiz to exit and you will lose your window borders and window management.