3
# The user can specify his prefered WM by setting the WINDOW_MANAGER
4
# environment variable or setting the
5
# /desktop/gnome/applications/window_manager/default gconf key.
7
# This script has been heavily modified to support Debian's
15
#read in the arguments
40
# Get previously set window manager in gconf
41
if [ ! "$DEFWM" ]; then
42
DEFWM=`gconftool-2 -g /desktop/gnome/applications/window_manager/default 2>/dev/null`
45
if ! which "$WINDOW_MANAGER" > /dev/null; then
47
if which "$DEFWM" > /dev/null; then
49
if [ "$WINDOW_MANAGER" = x-window-manager ]; then
50
WINDOW_MANAGER=`readlink /etc/alternatives/x-window-manager 2>/dev/null`
52
# if nothing is found, first use metacity
53
elif [ -x /usr/bin/metacity ]; then
54
WINDOW_MANAGER=/usr/bin/metacity
55
elif [ -x /usr/bin/compiz ]; then
56
WINDOW_MANAGER=/usr/bin/compiz
57
elif [ -x /usr/bin/sawfish ]; then
58
WINDOW_MANAGER=/usr/bin/sawfish
60
WINDOW_MANAGER=`readlink /etc/alternatives/x-window-manager 2>/dev/null`
64
# If no window manager can be found, we default to xterm
65
if [ ! "$WINDOW_MANAGER" ]; then
66
echo "WARNING: No window manager can be found."
67
WINDOW_MANAGER=`readlink /etc/alternatives/x-terminal-emulator 2>/dev/null`
70
# If there is no xterm, they're really screwed.
71
if [ ! "$WINDOW_MANAGER" ]; then
72
echo "ERROR: No window manager and no xterm!"
76
# Now create options OPT1 and OPT2 based on the windowmanager used
79
if [ ! -z "$SMID" ] ; then
80
case `basename "$WINDOW_MANAGER"` in
82
OPT1=--sm-client-id=$SMID
91
OPT1=--sm-client-id=$SMID
112
# Store the selected WM with gconf
113
gconftool-2 -t string -s /desktop/gnome/applications/window_manager/current "$WINDOW_MANAGER"
115
exec "$WINDOW_MANAGER" $OPT1 $OPT2
117
echo "ERROR: No window manager could run!"