All pastes #938433 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-11 17:24 UTC
rendered paste body
#!/bin/sh

COMPIZ_BIN_PATH="/usr/local/bin/" # For window decorators and compiz

# Default to gtk/kde-window-decorator
USE_EMERALD="no"

DECORATOR=""

# Set to yes to enable verbose
VERBOSE="yes"

# Echos the arguments if verbose
verbose()
{
	if [ "x$VERBOSE" = "xyes" ]; then
		printf "$*"
	fi
}

####################
# Execution begins here.

# Read configuration from XDG paths
if [ -z "$XDG_CONFIG_DIRS" ]; then
	test -f /etc/xdg/compiz/compiz-manager && . /etc/xdg/compiz/compiz-manager
else
	test -f $XDG_CONFIG_DIRS/compiz/compiz-manager && . $XDG_CONFIG_DIRS/compiz/compiz-manager
fi

if [ -z "$XDG_CONFIG_HOME" ]; then
	test -f $HOME/.config/compiz/compiz-manager && . $HOME/.config/compiz/compiz-manager
else
	test -f $XDG_CONFIG_HOME/compiz/compiz-manager && .  $XDG_CONFIG_HOME/compiz/compiz-manager
fi

# start a decorator
if [ -x ${COMPIZ_BIN_PATH}emerald ] && [ "$USE_EMERALD" = "yes" ]; then
	DECORATOR=emerald
elif [ -x ${COMPIZ_BIN_PATH}gtk-window-decorator ] && [ -n "$GNOME_DESKTOP_SESSION_ID" ]; then
	DECORATOR=gtk-window-decorator
elif [ -x ${COMPIZ_BIN_PATH}kde-window-decorator ] && [ -n "$KDE_FULL_SESSION" ]; then
	DECORATOR=kde-window-decorator
fi

# fall back to any decorator that is installed
if [ -z "$DECORATOR" ]; then
	verbose "Couldn't find a perfect decorator match; trying all decorators\n"
	if [ -x ${COMPIZ_BIN_PATH}emerald ]; then
		DECORATOR=emerald
	elif [ -x ${COMPIZ_BIN_PATH}gtk-window-decorator ]; then
		DECORATOR=gtk-window-decorator
	elif [ -x ${COMPIZ_BIN_PATH}kde-window-decorator ]; then
		DECORATOR=kde-window-decorator
	fi
fi

if [ -n "$DECORATOR" ]; then
	verbose "Starting ${DECORATOR}\n"
	${COMPIZ_BIN_PATH}$DECORATOR "$@"
else
	verbose "Found no decorator to start\n"
fi