I have a super simple script.

Code:
#!/bin/bash

# Disable composite window manager
metacity --replace

# Enter Program Directory
cd /home/user/.wine/drive_c/Program\ Files/Railroad\ Tycoon\ 3/
wine RT3.exe

# Restore composite window manager
compiz --replace

exit 0
So here is what happens. I open gnome-terminal. The script is currently hanging out in my scripts directory so I cd into there. Then I run the script

./launch_railroad3

And it works beautifully. No issues. Entering the commands manually one at a time works perfectly as well.

Now I point a launcher to it from the gnome-menu. Its only parameter is running the script. The script seems to work at first. The composite desktop turns off, everything goes flat. Then the game blanks to fullscreen and tweaks the crud out. Flickering stuff, wicked garbled screen, giant stuff on the screen, badness indeed. I can ctrl alt F2 and while I can't see anything I can enter the commands to restart gdm but that restarts in a tweaked out mode just like the game except I can see bits of the gnome login screen there.

My question is, what on earth is going on? What is different about the environment in which a script is launched from the command line vs the environment in which a script is launched from a launcher .desktop file? If I can figure that out I can maybe fix this. Thanks!