Skip to content

Instantly share code, notes, and snippets.

@stedolan
Created July 10, 2011 10:24
Show Gist options
  • Save stedolan/1074445 to your computer and use it in GitHub Desktop.
Save stedolan/1074445 to your computer and use it in GitHub Desktop.
Switch Compiz on/off
#!/bin/bash
dir="$1"
if pidof compiz > /dev/null; then
current=on
else
current=off
fi
if [ -z "$dir" ]; then
if [ $current = on ]; then
dir=off
else
dir=on
fi
fi
if ! [ "$dir" = "off" -o "$dir" = on ]; then
echo "Usage: $0 off [turn off compiz]"
echo " $0 on [turn on compiz]"
echo " $0 [toggle compiz]"
exit 1
fi
if [ $dir = $current ]; then
echo "Compiz is already $dir!"
exit 0
fi
echo "Turning compiz $dir"
if [ "$dir" = "on" ]; then
compiz --replace &
else
metacity --replace &
fi
disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment