before, if DESKTOP_STARTUP_ID was set in openbox, it would mess up adding it to the child's environment because it would appear twice. so now it will only appear once for the child always.
cmd, e->message);
g_error_free(e);
} else if (data->execute.startupnotify) {
cmd, e->message);
g_error_free(e);
} else if (data->execute.startupnotify) {
program = g_path_get_basename(argv[0]);
program = g_path_get_basename(argv[0]);
- env = sn_get_spawn_environment(program,
- data->execute.name,
- data->execute.icon_name,
- /* launch it on the current
- desktop */
- screen_desktop,
- data->execute.any.time);
- if (!g_spawn_async(NULL, argv, env, G_SPAWN_SEARCH_PATH |
+ /* sets up the environment */
+ sn_setup_spawn_environment(program,
+ data->execute.name,
+ data->execute.icon_name,
+ /* launch it on the current
+ desktop */
+ screen_desktop,
+ data->execute.any.time);
+ if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH |
G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, NULL, &e)) {
g_warning("failed to execute '%s': %s",
G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, NULL, &e)) {
g_warning("failed to execute '%s': %s",
g_error_free(e);
sn_spawn_cancel();
}
g_error_free(e);
sn_spawn_cancel();
}
g_free(program);
g_strfreev(argv);
} else {
g_free(program);
g_strfreev(argv);
} else {
#include "startupnotify.h"
#include "gettext.h"
#include "startupnotify.h"
#include "gettext.h"
return CurrentTime;
}
gboolean sn_get_desktop(gchar *id, guint *desktop) { return FALSE; }
return CurrentTime;
}
gboolean sn_get_desktop(gchar *id, guint *desktop) { return FALSE; }
-gchar **sn_get_spawn_environment(char *program, char *name,
- char *icon_name, gint desktop, Time time)
+void sn_setup_spawn_environment(gchar *program, gchar *name,
+ gchar *icon_name, gint desktop, Time time)
{
return g_strdupv(environ);
}
{
return g_strdupv(environ);
}
return FALSE; /* don't repeat */
}
return FALSE; /* don't repeat */
}
-gchar **sn_get_spawn_environment(char *program, char *name,
- char *icon_name, gint desktop,
- Time time)
+void sn_setup_spawn_environment(gchar *program, gchar *name,
+ gchar *icon_name, gint desktop,
+ Time time)
- gchar **env, *desc;
- guint len;
const char *id;
desc = g_strdup_printf(_("Running %s\n"), program);
const char *id;
desc = g_strdup_printf(_("Running %s\n"), program);
sn_launch_wait_timeout, sn_launcher,
(GDestroyNotify)sn_launcher_context_unref);
sn_launch_wait_timeout, sn_launcher,
(GDestroyNotify)sn_launcher_context_unref);
- env = g_strdupv(environ);
- len = g_strv_length(env); /* includes last null */
- env = g_renew(gchar*, env, ++len); /* add one spot */
- env[len-2] = g_strdup_printf("DESKTOP_STARTUP_ID=%s", id);
- env[len-1] = NULL;
+ setenv("DESKTOP_STARTUP_ID", id, TRUE);
gboolean sn_get_desktop(gchar *id, guint *desktop);
/* Get the environment to run the program in, with startup notification */
gboolean sn_get_desktop(gchar *id, guint *desktop);
/* Get the environment to run the program in, with startup notification */
-gchar **sn_get_spawn_environment(char *program, char *name,
- char *icon_name, gint desktop,
- Time time);
+void sn_setup_spawn_environment(gchar *program, gchar *name,
+ gchar *icon_name, gint desktop,
+ Time time);
/* Tell startup notification we're not actually running the program we
told it we were
/* Tell startup notification we're not actually running the program we
told it we were