]> Dogcows Code - chaz/openbox/commitdiff
Run Openbox with gnome-session the proper way, without using the deprecated gnome-wm.
authorDana Jansens <danakj@orodu.net>
Thu, 10 Dec 2009 16:44:28 +0000 (11:44 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Dec 2009 16:47:12 +0000 (11:47 -0500)
See https://bugzilla.gnome.org/show_bug.cgi?id=555406#c5
Hopefully this continues to work for a while.

data/xsession/openbox-gnome-session.in

index 86b7d06f266e7c5d5dbc08a47b760c42d8bee8dc..de46bec534476029cb6567e269bb5c9e7cc80345 100644 (file)
@@ -18,20 +18,42 @@ VER=$(gnome-session --version 2>/dev/null | \
 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
+  # old gnome-session was easy to work with
+  export WINDOW_MANAGER="@bindir@/openbox"
   exec gnome-session --choose-session=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 does not allow multiple sessions
-  exec gnome-session "$@"
+  # new 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 test -z $(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 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 "$@"
 fi
 
 
This page took 0.019966 seconds and 4 git commands to generate.