diff --git a/spawn.c b/spawn.c index 01e255cc5..7e4fee363 100644 --- a/spawn.c +++ b/spawn.c @@ -260,7 +260,14 @@ spawn_launchee_timeout(gpointer context) static void spawn_callback(gpointer user_data) { + SnLauncherContext *context = (SnLauncherContext *) user_data; setsid(); + + if (context) + sn_launcher_context_setup_child_process(context); + else + /* Unset in case awesome was already started with this variable set */ + unsetenv("DESKTOP_STARTUP_ID"); } /** Parse a command line. @@ -352,12 +359,11 @@ luaA_spawn(lua_State *L) /* app will have AWESOME_SPAWN_TIMEOUT seconds to complete, * or the timeout function will terminate the launch sequence anyway */ g_timeout_add_seconds(AWESOME_SPAWN_TIMEOUT, spawn_launchee_timeout, context); - sn_launcher_context_setup_child_process(context); } GError *error = NULL; retval = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, - spawn_callback, NULL, &pid, &error); + spawn_callback, context, &pid, &error); g_strfreev(argv); if(!retval) {