diff -up openbox-3.4.7.2/openbox/session.c.autostartid openbox-3.4.7.2/openbox/session.c --- openbox-3.4.7.2/openbox/session.c.autostartid 2008-04-14 01:22:12.000000000 +0200 +++ openbox-3.4.7.2/openbox/session.c 2008-12-09 18:04:50.000000000 +0100 @@ -174,6 +174,16 @@ static gboolean session_connect(void) /* connect to the server */ oldid = ob_sm_id; + + if (!oldid) { + const gchar *autostart_id = g_getenv("DESKTOP_AUTOSTART_ID"); + + if (autostart_id) { + oldid = g_strdup(autostart_id); + g_unsetenv("DESKTOP_AUTOSTART_ID"); + } + } + ob_debug_type(OB_DEBUG_SM, "Connecting to SM with id: %s\n", oldid ? oldid : "(null)"); sm_conn = SmcOpenConnection(NULL, NULL, 1, 0,