Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Script to replace compiz with metacity during gaming.

  1. #11
    Join Date
    Jan 2008
    Location
    Auckland, New Zealand
    Beans
    3,129
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Script to replace compiz with metacity during gaming.

    Quote Originally Posted by washeddang View Post
    Since I use AWN and screenlets, I like to use metacity with compositing. I put together a similar script that checks if compiz is running and switches to metacity with compositing and vice versa:

    I copied the script to the ~/.gnome2/nautilus-scripts folder so that I can run it from the Scripts menu when I right-click in Nautilus.
    Ah ok cool. Yeah I don't think my script works if metacity compositing is enabled as compiz won't replace it. Something like this would need to be used.

  2. #12
    Join Date
    Mar 2010
    Beans
    19

    Re: Script to replace compiz with metacity during gaming.

    Thanks for the script, it's just perfect! I'm using an awn too but the latest version doesn't disappear without compositing.
    I tried to put your code inside an bash script that creates your one:
    Code:
    #!/bin/bash
    #Creating "playgame" script in /usr/games
    cat > ~/playgame <<EOF
    #!/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
    EOF
    sudo cp ~/playgame /usr/games/
    sudo chmod +x /usr/games/playgame
    
    exit
    but in the end the actual file is missing essential fragments:

    #!/bin/bash

    if [ 0 -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
    Can someone suggest a solution to my problem
    Last edited by ttanev; October 18th, 2010 at 11:57 AM.

  3. #13
    Join Date
    Apr 2010
    Beans
    88
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Script to replace compiz with metacity during gaming.

    The shell is expanding the special variables $# and $@ before writting out to the file so you get the current values of those variables.

    You need to quote the $ char to print an actual $, so change to (note the \ before the $'s):

    if [ \$# -lt 1 ]; then
    .
    .
    \$@

  4. #14
    Join Date
    Mar 2010
    Beans
    19

    Re: Script to replace compiz with metacity during gaming.

    Quote Originally Posted by dethorpe View Post
    The shell is expanding the special variables $# and $@ before writting out to the file so you get the current values of those variables.

    You need to quote the $ char to print an actual $, so change to (note the \ before the $'s):

    if [ \$# -lt 1 ]; then
    .
    .
    \$@
    You will have to excuse my ignorance. At first I didn't got it but with some searching about "quote the $ char" found more expanded answer here - http://tldp.orthe g/LDP/Bash-Beginners-Guide/html/sect_03_03.html
    Thank you!

  5. #15
    Join Date
    Mar 2010
    Beans
    19

    Re: Script to replace compiz with metacity during gaming.

    I was just curious - is it possible to implement in the script functionality to detect whether 3D app is running in fullscreen and if so to automatically switch to metacity ?
    That would involve more than a bash script in the equation I guess...

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •