File compiz-manager-setup.patch of Package compiz-manager

Index: compiz-manager-0.6.0/compiz-manager
===================================================================
--- compiz-manager-0.6.0.orig/compiz-manager
+++ compiz-manager-0.6.0/compiz-manager
@@ -25,11 +25,18 @@
 # This script will detect what options we need to pass to compiz to get it
 # started, and start a default plugin and possibly window decorator.
 # 
+ARCH=`arch`
+if [ $ARCH == "x86_64" ]; then
+     LIB=lib64
+else
+     LIB=lib
+fi
 
+PREFIX=$(dirname $(dirname $(which compiz)))
 
-COMPIZ_BIN_PATH="/usr/local/bin/" # For window decorators and compiz
-PLUGIN_PATH="/usr/local/lib/compiz/" 
-GLXINFO="/usr/bin/glxinfo"
+COMPIZ_BIN_PATH="${PREFIX}/bin/" # For window decorators and compiz
+PLUGIN_PATH="${PREFIX}/${LIB}/compiz/"
+GLXINFO=$(which glxinfo)
 KWIN="/usr/bin/kwin"
 METACITY="/usr/bin/metacity"
 COMPIZ_NAME="compiz" # Final name for compiz (compiz.real) 
@@ -62,9 +69,15 @@ BLACKLIST_PCIIDS="$T"
 unset T
 
 COMPIZ_OPTIONS="--ignore-desktop-hints --replace"
-COMPIZ_PLUGINS=""
+# Those are bare minimum plugins. anything else might want to be enabled / disabled by users.
+COMPIZ_PLUGINS="core composite opengl decor move resize"
 ENV=""
 
+#If the user does not yet have a populated Default.ini, we'll drop a default in his config folder
+if [ ! -s "$HOME/.config/compiz-1/compizconfig/Default.ini" ]; then
+  install -D "/usr/share/compiz-manager/config.skel" "$HOME/.config/compiz-1/compizconfig/Default.ini"
+fi
+
 # Use emerald by default if it exist
 USE_EMERALD="yes"
 
@@ -380,5 +393,10 @@ elif [ -x ${COMPIZ_BIN_PATH}kde-window-d
 	FALLBACKWM="${KWIN}"
 fi
 
+# In case we are in a gnome session, we always want gnomecompat plugin loaded (session registering, key bindings)
+if [ -f ${PLUGIN_PATH}libgnomecompat.so ] && [ -n "$GNOME_DESKTOP_SESSION_ID" ] ; then
+  COMPIZ_PLUGINS="$COMPIZ_PLUGINS gnomecompat"
+fi
+
 ${COMPIZ_BIN_PATH}${COMPIZ_NAME} $COMPIZ_OPTIONS "$@" $COMPIZ_PLUGINS || exec $FALLBACKWM $FALLBACKWM_OPTIONS