#!/bin/sh
-AUTOSTART="$HOME/.config/openbox/autostart"
-
-if test -e $AUTOSTART; then
- # sleep for 1 second so Openbox is there before anything else
- (sleep 1 && . $AUTOSTART) &
+if test -n "$1"; then
+ echo "Syntax: openbox-session"
+ echo
+ echo "See the openbox-session(1) manpage for help."
+ exit
fi
-exec @bindir@/openbox "$@"
+# Clean up after GDM
+xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
+ -remove _NET_DESKTOP_NAMES \
+ -remove _NET_CURRENT_DESKTOP 2> /dev/null
+
+# Set up the environment
+A="@configdir@/openbox/environment"
+test -r $A && . $A
+A="${XDG_CONFIG_HOME:-"$HOME/.config"}/openbox/environment"
+test -r $A && . $A
+
+# Run Openbox, and have it run the autostart stuff
+exec @bindir@/openbox --startup "@libexecdir@/openbox-autostart OPENBOX" "$@"