#!/bin/sh # Starts Compiz Decorator depending on the DE # # Copyright (c) 2007 CyberOrg # Based on compiz-manager script by Kristian Lyngstøl # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Contributions by: crdlb # Modifications by: Daniel van Vugt # Additional Changes by: BryanFRitt # Default to gtk-window-decorator or kde4-window-decorator USE_EMERALD="no" DECORATOR="" # Set to yes to enable verbose VERBOSE="yes" # Set COMPIZ_BIN_PATH if need be if [ -z "${COMPIZ_BIN_PATH}" ]; then #COMPIZ_BIN_PATH="/usr/bin/" # ?set default to the bin path is in the same path as this file, or to do above? COMPIZ_BIN_PATH=$(cd $(dirname "$0"); pwd) #echo "${COMPIZ_BIN_PATH}" fi # Echos the arguments if verbose verbose() { if [ "${VERBOSE}" = "yes" ]; then echo "$@" fi } # 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 # Pick 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}/kde4-window-decorator" ] && [ "${KDE_SESSION_VERSION}" = "4" ]; then DECORATOR="kde4-window-decorator" fi # If a decorator wasn't picked out, fall back to 1st decorator found if [ -z "${DECORATOR}" ]; then verbose "Couldn't find a perfect decorator match; using 1st decorator found" 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}/kde4-window-decorator" ]; then DECORATOR="kde4-window-decorator" fi fi # Start a decorator if [ -n "${DECORATOR}" ]; then verbose "Starting ${DECORATOR}" exec "${COMPIZ_BIN_PATH}/${DECORATOR}" "$@" "--replace" & else # If there isn't a compiz decorator available, try not leave users without decoration if [ "${DESKTOP_SESSION}" = "kde-plasma" ]; then FALLBACKWM=`which kwin` # typically "/usr/bin/kwin" else FALLBACKWM=`which metacity` # typically "/usr/bin/metacity" fi FALLBACKWM_OPTIONS="--replace" verbose "Couldn't find a decorator to start, running fallback" verbose "exec ${FALLBACKWM} ${FALLBACKWM_OPTIONS} &" exec "${FALLBACKWM}" "${FALLBACKWM_OPTIONS}" & fi