Update version in configure.ac to 3.5.2
[openbox.git] / data / xsession / openbox-gnome-session.in
blobf31c9ad2c704fd380f6caff3fab4432918a201e7
1 #!/bin/sh
3 if test -n "$1"; then
4 echo "Syntax: openbox-gnome-session"
5 echo
6 echo "See the openbox-gnome-session(1) manpage for help."
7 exit
8 fi
10 # Clean up after GDM
11 xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
12 -remove _NET_DESKTOP_NAMES \
13 -remove _NET_CURRENT_DESKTOP 2> /dev/null
15 VER=$(gnome-session --version 2>/dev/null | \
16 sed -e 's/[^0-9.]*\([0-9.]\+\)/\1/')
18 MAJOR=$(echo $VER | cut -d . -f 1)
19 MINOR=$(echo $VER | cut -d . -f 2)
21 # run GNOME with Openbox as its window manager
23 if test $MAJOR -lt 2 || (test $MAJOR = 2 && test $MINOR -le 22); then
24 # older gnome-session was easy to work with
25 export WINDOW_MANAGER="@bindir@/openbox"
26 exec gnome-session --choose-session=openbox-session "$@"
27 elif test $MAJOR -lt 3; then
28 # old gnome-session requires openbox to be set in gconf and an
29 # openbox.desktop to be installed in the applications directory
31 SPATH=/desktop/gnome/session
33 # get the current default session
34 SESSION=$(gconftool-2 -g $SPATH/default_session 2> /dev/null)
36 # make sure openbox is going to be run
37 if test -z "$SESSION"; then
38 # if its empty then just run openbox
39 SESSION="[openbox]"
40 elif ! echo "$SESSION" | grep -q openbox; then
41 # if openbox isn't in the session then append it
42 SESSION="${SESSION%]},openbox]"
45 # get the current GNOME/Openbox session
46 OB_SESSION=$(gconftool-2 -g $SPATH/openbox_session 2> /dev/null)
48 # update the GNOME/Openbox session if needed
49 if test x$OB_SESSION != x$SESSION; then
50 # the default session changed or we didn't run GNOME/Openbox before
51 gconftool-2 -t list --list-type=strings -s $SPATH/openbox_session \
52 "$SESSION" 2> /dev/null
55 # run GNOME/Openbox
56 exec gnome-session --default-session-key $SPATH/openbox_session "$@"
57 else
58 # new gnome-session requires session file installed in
59 # /usr/share/gnome-session/sessions as well as openbox.desktop to be
60 # installed in the applications directory
62 exec gnome-session --session=openbox-gnome