diff options
author | Kristian Lyngstøl <kristian@albus.(none)> | 2007-09-18 17:14:00 +0200 |
---|---|---|
committer | Kristian Lyngstøl <kristian@albus.(none)> | 2007-09-18 17:14:00 +0200 |
commit | 13b1e82b8acc6aa9337f897f772982cf49e11551 (patch) | |
tree | e52b7161274e9fc352ded5b30f829e12361bcc5c | |
parent | e48163d6eb7b99fcc16d96a5762b7a20cf56224a (diff) | |
download | compiz-scripts-master.tar.gz compiz-scripts-master.tar.bz2 |
-rwxr-xr-x | manager/compiz-manager | 484 | ||||
-rw-r--r-- | manager/compiz-managerrc | 44 |
2 files changed, 0 insertions, 528 deletions
diff --git a/manager/compiz-manager b/manager/compiz-manager deleted file mode 100755 index 2dae801..0000000 --- a/manager/compiz-manager +++ /dev/null @@ -1,484 +0,0 @@ -#!/bin/sh -# Compiz manager -# Copyright (c) 2007 Kristian Lyngstøl <kristian@bohemians.org> -# -# 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 -# -# -# Much of this code is based on Beryl code, also licensed under the GPL. -# This script will detect what options we need to pass to compiz to get it -# started, read a simple configuration file, and start a default -# plugin and possibly window decorator. -# All of this should be possible to override in a configuration file. - - -# Todo: -# - GUI, possibly in a second script. -# - Testing on Xgl -# - Configuration file sanity tests - -######################################################################### -# You should NOT edit this, edit the configuration file instead. # -# This is left for completness and if you need to modify the script. # -# The generated configuration file should be equally documented. # -######################################################################### - -# Set to yes to enable verbose (-v) by default. -VERBOSE="yes" - -# Default arguments. Others are added to this, and the configuration can -# override ALL arguments. -ARGS="--sm-disable --replace" - -# Ditto for enviromental variables. -ENV="" - -# Default plugins. Should probably be ini, gconf or ccp. -PLUGINS="ccp" - -# Defines the decorator and arguments. -# Set it to empty to not use a decorator. -DECORATOR="emerald" -DECORATORARGS="--replace" - -# Delay in seconds before we bring up the decorator(s) -# This avoids starting the decorator before the WM is up, -# even if it shouldn't be a problem. -DELAY="5" - -# Set to "no" to pipe all decorator error messages to /dev/null -DECOERRORS="no" - -# Internal, used to process options. -TASK="normal" - -# No indirect by default -INDIRECT=1 - -# Echos the arguments if verbose -verbose() -{ - if [ "x$VERBOSE" = "xyes" ]; then - echo -n "$*" - fi -} - -### System checks -# These are used for checking what hardware and software we're dealing with, -# so we can decide what options to pass to compiz, if it's even possible to -# start compiz. - -# Check wether the composite extension is present -check_composite() -{ - verbose "Checking for Composite extension: " - if xdpyinfo -queryExtensions | grep -q Composite ; then - verbose "present. \n"; - return 0; - else - verbose "not present. \n"; - return 1; - fi -} - -check_xdamage() -{ - verbose "Checking for XDamage extension: " - if xdpyinfo -queryExtensions | grep -q DAMAGE ; then - verbose "present. \n"; - return 0; - else - verbose "not present. \n"; - return 1; - fi -} -# Check for existence if NV-GLX -check_nvidia() -{ - verbose "Checking for nVidia: " - if xdpyinfo | grep -q NV-GLX ; then - verbose "present. \n" - return 0; - else - verbose "not present. \n" - return 1; - fi -} - -# Detects if Xgl is running -check_xgl() -{ - verbose "Checking for Xgl: " - if xvinfo | grep -q Xgl ; then - verbose "present. \n" - return 0; - else - verbose "not present. \n" - return 1; - fi -} - -# Check for presence of FBConfig -check_fbconfig() -{ - verbose "Checking for FBConfig: " - if glxinfo 2> /dev/null | grep -q GLX_SGIX_fbconfig ; then - verbose "present. \n" - return 0; - else - verbose "not present. \n" - return 1; - fi -} - -# Check for TFP -check_tfp() -{ - verbose "Checking for texture_from_pixmap: " - if [ `glxinfo 2>/dev/null | grep GLX_EXT_texture_from_pixmap -c` -gt 2 ] ; then - verbose "present. \n" - return 0; - else - verbose "not present. \n" - if [ "$INDIRECT" -eq 0 ]; then - unset LIBGL_ALWAYS_INDIRECT - INDIRECT=1 - return 1; - else - verbose "Trying again with indirect rendering:"; - INDIRECT=0 - export LIBGL_ALWAYS_INDIRECT=1 - check_tfp; - return $? - fi - fi -} - -# Check for non power of two texture support -check_npot_texture() -{ - verbose "Checking for non power of two support: " - if glxinfo | egrep -q '(GL_ARB_texture_non_power_of_two|GL_NV_texture_rectangle|GL_EXT_texture_rectangle|GL_ARB_texture_rectangle)' ; then - verbose "present. \n"; - return 0; - else - verbose "Not present. \n" - return 1; - fi - -} - -check_xsync() -{ - verbose "Checking for XSync extension: "; - if xdpyinfo -queryExtensions | grep -q SYNC ; then - verbose "present. \n"; - return 0; - else - verbose "not present. \n" ; - fi -} - -# Counts how many screens we have, and the base value for DISPLAY= -# so we can easily start one decorator per screen -check_multiscreen() -{ - SCREENS=$(xdpyinfo | grep "screen #" | wc -l) - verbose "Detected $SCREENS screen(s)\n"; - if [ "$SCREENS" = "1" ]; then return 0; fi; - verbose "Multiscreen enviromental detection: " - DISPLAYBASE=$(xdpyinfo | grep name\ of\ display | sed 's/.* display: *//' | sed 's/\..*//') - verbose "\tDetected $DISPLAYBASE as the base of the DISPLAY variable"; - SCREENNUMBERS=$(xdpyinfo | grep "screen #" | sed -r 's/screen #(.):/\1/') - for a in $SCREENNUMBERS ; do - MULTIDISPLAY[$a]=${DISPLAYBASE}.$a -# verbose "\tMULTIDISPLAY[$a] set to: ${MULTIDISPLAY[$a]}"; - - done -} - -possible_check() -{ - if [ ! "$1" ]; then - echo "Fatal: Failed test: $2"; - return 1; - fi - return 0; -} -# Returns true if we think it's actually possible to start compiz -check_possible() -{ - POSSIBLE="1" - if ! possible_check "$TFP" "texture_from_pixmap support"; then return 1; fi - if ! possible_check "$NPOT" "non-power-of-two texture support"; then return 1; fi - if ! possible_check "$FBCONFIG" "FBConfig"; then return 1; fi - if ! possible_check "$COMPOSITE" "Composite extension"; then return 1; fi - if ! possible_check "$XDAMAGE" "XDamage extension"; then return 1; fi - if ! possible_check "$XSYNC" "XSync extension"; then return 1; fi - POSSIBLE="0"; - return 0; -} - - -### Work functions - -# Builds a new-line seperated string of enviromental variables we might want -build_env() -{ - if [ $NVIDIA -eq 0 ]; then - ENV="__GL_YIELD=NOTHING " - fi - if [ $INDIRECT -eq 0 ]; then - ENV="$ENV LIBGL_ALWAYS_INDIRECT=1 " - fi -} - -# Builds the argument list -build_args() -{ - if [ $NVIDIA -eq 0 -a $XGL 0 -a $INDIRECT 0 ]; then - ARGS="--loose-binding "$ARGS - fi - if [ $INDIRECT -eq 0 ]; then - ARGS="--indirect-rendering "$ARGS - fi -} - - -# Prints usage -usage() -{ - echo "Usage: $0 [-r <env|args>] [-v] [-h] [-d] [-w]" - echo "-r\toutputs recommended values for either " - echo " \tenviromental variables, or arguments." - echo "-v\tVerbose: Output the result of each individual test" - echo "-h\tDisplay this message"; - echo "-d\tDry run: Do everything, but don't start." - echo "-w\tOnly start window decorator(s). One per screen."; -} - -# Parses options -parse_options() -{ - for a in $*; do - if [ "$a" = "-v" ]; then - VERBOSE="yes"; - elif [ "$a" = "-d" ]; then - DRY="yes"; - elif [ "$a" = "-r env" ]; then - REC="env"; - elif [ "$a" = "-r args" ]; then - REC="args"; - elif [ "$a" = "-r both" ]; then - REC="both" - elif [ "$a" = "-w" ]; then - TASK="WINDOWDECORATOR" - else - usage - exit - fi - done -} - -#### -# Execute checks, if necesarry. -check_everything() -{ - if [ -z "$NVIDIA" ]; then - check_nvidia - NVIDIA=$? - else - verbose "Skipping nVidia check, using stored value." - fi - if [ -z "$XGL" ]; then - check_xgl - XGL=$? - else - verbose "Skipping Xgl check, using stored value." - fi - - if [ -z "$FBCONFIG" ]; then - check_fbconfig - FBCONFIG=$? - else - verbose "Skipping FBConfig check, using stored value." - fi - check_tfp - TFP=$? - if [ -z "$NPOT" ]; then - check_npot_texture - NPOT=$? - else - verbose "Skipping non-power-of-two texture check, using stored value." - fi - - if [ -z "$COMPOSITE" ]; then - check_composite - COMPOSITE=$? - else - verbose "Skipping Composite extension check, using stored value." - fi - - if [ -z "$XDAMAGE" ]; then - check_xdamage - XDAMAGE=$? - else - verbose "Skipping Damage extension check, using stored value." - fi - - if [ -z "$XSYNC" ]; then - check_xsync - XSYNC=$? - else - verbose "Skipping XSync extension check, using stored value."; - fi - - if [ -z "$SCREENS" ]; then - check_multiscreen - else - verbose "Skipping screen detection check, using stored value."; - fi -} - -### -# Check if a directory exists; creates it if it doesn't, returns false if the -# path isn't a directory. -require_dir() -{ - if ! [ -a "$1" ]; then - verbose "Creating directory $1"; - mkdir $1; - fi - if [ ! -d $1 ]; then - echo "Warning: $1 exists but isn't a directory."; - return 1; - fi - return 0; -} - - -#### -# Configuration handeling -# We attempt to follow the XDG basedir spec here; -# We can read both a global config, and a local one. -# The configuration file is extremly simple, as it's just a bash script. -# It might be a good idea to improve that a bit, specially with security -# in mind, an general errors. - -# No config, so unset and possibly warn. (Might do more later) -no_config() -{ - if [ -n "$1" ]; then - echo "$1"; - fi - unset CONFIG -} - -### -# Let's get this show started! -start_compiz() -{ - ### - # No need to continue if we've determined it's not possible to start anyway - if [ $POSSIBLE != "0" ]; then - echo "Checks indicate that it's impossible to start compiz on your system." - exit 1; - else - verbose "Checks indicate compiz should work on your system" - fi; - verbose "Exporting: $ENV " - export $ENV - verbose Executing: compiz $ARGS $PLUGINS "" - if [ "x$DRY" = "xyes" ]; then exit 0; fi - compiz $ARGS $PLUGINS -} - -#### -# Starts one decorator per screen -start_decorators() -{ - if [ -z "$DECORATOR" ]; then return 1; fi - if [ "$SCREENS" == "1" ]; then - verbose "Starting delayed decorator in the background: " - verbose "sleep $DELAY && $DECORATOR $DECORATORARGS &" - if [ "x$DRY" = "xyes" ]; then return 0; fi - if [ "$DECOERRORS" = "no" ]; then - sleep $DELAY && $DECORATOR $DECORATORARGS 2>/dev/null & - else - sleep $DELAY && $DECORATOR $DECORATORARGS & - fi - return 0; - fi - verbose "Starting decorators for all screens: " - for a in $SCREENNUMBERS; do - verbose "\t Screen $a: " - if [ "x$DRY" != "xyes" ]; then - if [ "$DECOERRORS" = "no" ]; then - sleep $DELAY && DISPLAY=${MULTIDISPLAY}$a $DECORATOR $DECORATORARGS 2>/dev/null & - else - sleep $DELAY && DISPLAY=${MULTIDISPLAY}$a $DECORATOR $DECORATORARGS & - fi - - fi - done -} - -#################### -# Execution begins here. -# First get options, check for configuration -# Check everything if necesarry, build the enviroment and arguments -# and eventually select a task. - -parse_options "$*" - -check_everything -### -# This is the master-test, it has to be done last. -check_possible - -if [ $POSSIBLE ]; -then - verbose "Checks finished - everything seems ok. \n"; -else - return 1; -fi -#### -# Builds the enviromental variables list and argument list based -# on the result of the checks -build_env() -build_args() - -case "$TASK" in - RECOMMEND) - if [ "x$REC" = "xenv" ]; then - echo -e $ENV; - elif [ "x$REC" = "xargs" ]; then - echo -e $ARGS - elif [ "x$REC" = "xboth" ]; then - echo -e $ARGS $PLUGINS - echo "$ENV" - fi - if [ $POSSIBLE != "0" ]; then return 1; fi - ;; - WINDOWDECORATOR) - echo "start window decorator here..." - start_decorators - ;; - *) - start_compiz - ;; -esac - diff --git a/manager/compiz-managerrc b/manager/compiz-managerrc deleted file mode 100644 index 027d6a1..0000000 --- a/manager/compiz-managerrc +++ /dev/null @@ -1,44 +0,0 @@ -# Autogenerated configuration -# Generated: Sun Apr 29 19:44:18 CEST 2007 -# On sunrider by kristian - -# Behavior references: (yes/no) -# Set this to "yes" to get the same result as if you ran compiz-manager with -v -#VERBOSE=yes - -# Plugins -PLUGINS="ini" -# Or, to append: -# PLUGINS="$PLUGINS <... >" - -# Arguments, same as plugins to append -# ARGS="$ARGS <... >" -#ARGS="--loose-binding --sm-disable --replace" - -# Screen detection: -SCREENS=2 -SCREENNUMBERS="0 -1" -MULTIDISPLAY[0]=:0.0 -MULTIDISPLAY[1]=:0.1 - -# Decorator -# Use "unset DECORATOR" or set DECORATOR="" to not use one. -DECORATOR="heliodor" -DECORATORARGS="--replace" -# Delay in seconds before the decorator is started. -DELAY="5" -# Set this to "no" to send all decorator errors to /dev/null -DECOERRORS="no" - -# Values of 0 mean "true" (present), values of 1 means "false" (not present) -# Checks: -NVIDIA=0 -FBCONFIG=0 -XGL=1 -TFP=0 -NPOT=0 -COMPOSITE=0 -XDAMAGE=0 -POSSIBLE=0 -XSYNC=0 |