X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=data%2Fxsession%2Fopenbox-gnome-session.in;h=f31c9ad2c704fd380f6caff3fab4432918a201e7;hb=e4e7c2be52ee1a0b75d9d2feff57fdc992fedb9b;hp=d93bab0cca67f22d9e360d33bbf972bcb983b3ff;hpb=4e0a4fb53b859d818a4184564a441fce29c12be0;p=chaz%2Fopenbox diff --git a/data/xsession/openbox-gnome-session.in b/data/xsession/openbox-gnome-session.in index d93bab0c..f31c9ad2 100644 --- a/data/xsession/openbox-gnome-session.in +++ b/data/xsession/openbox-gnome-session.in @@ -7,26 +7,59 @@ if test -n "$1"; then exit fi +# Clean up after GDM +xprop -root -remove _NET_NUMBER_OF_DESKTOPS \ + -remove _NET_DESKTOP_NAMES \ + -remove _NET_CURRENT_DESKTOP 2> /dev/null + VER=$(gnome-session --version 2>/dev/null | \ sed -e 's/[^0-9.]*\([0-9.]\+\)/\1/') MAJOR=$(echo $VER | cut -d . -f 1) MINOR=$(echo $VER | cut -d . -f 2) -# Run GNOME with Openbox as its window manager -export WINDOW_MANAGER="@bindir@/openbox" +# run GNOME with Openbox as its window manager if test $MAJOR -lt 2 || (test $MAJOR = 2 && test $MINOR -le 22); then - # old gnome-session allows multiple sessions to be saved + # older gnome-session was easy to work with + export WINDOW_MANAGER="@bindir@/openbox" exec gnome-session --choose-session=openbox-session "$@" +elif test $MAJOR -lt 3; then + # old gnome-session requires openbox to be set in gconf and an + # openbox.desktop to be installed in the applications directory + + SPATH=/desktop/gnome/session + + # get the current default session + SESSION=$(gconftool-2 -g $SPATH/default_session 2> /dev/null) + + # make sure openbox is going to be run + if test -z "$SESSION"; then + # if its empty then just run openbox + SESSION="[openbox]" + elif ! echo "$SESSION" | grep -q openbox; then + # if openbox isn't in the session then append it + SESSION="${SESSION%]},openbox]" + fi + + # get the current GNOME/Openbox session + OB_SESSION=$(gconftool-2 -g $SPATH/openbox_session 2> /dev/null) + + # update the GNOME/Openbox session if needed + if test x$OB_SESSION != x$SESSION; then + # the default session changed or we didn't run GNOME/Openbox before + gconftool-2 -t list --list-type=strings -s $SPATH/openbox_session \ + "$SESSION" 2> /dev/null + fi + + # run GNOME/Openbox + exec gnome-session --default-session-key $SPATH/openbox_session "$@" else - # make sure the gnome-wm script is being used - gconftool-2 -t string \ - -s /desktop/gnome/session/required_components/windowmanager "gnome-wm" \ - 2> /dev/null + # new gnome-session requires session file installed in + # /usr/share/gnome-session/sessions as well as openbox.desktop to be + # installed in the applications directory - # new gnome-session does not allow multiple sessions - exec gnome-session "$@" + exec gnome-session --session=openbox-gnome fi