act->data.execute.path = parse_expand_tilde(s);
g_free(s);
}
+ if ((n = parse_find_node("startupnotify", node->xmlChildrenNode))) {
+ xmlNodePtr m;
+ if ((m = parse_find_node("enabled", n->xmlChildrenNode)))
+ act->data.execute.startupnotify = parse_bool(doc, m);
+ if ((m = parse_find_node("name", n->xmlChildrenNode)))
+ act->data.execute.name = parse_string(doc, m);
+ if ((m = parse_find_node("icon", n->xmlChildrenNode)))
+ act->data.execute.icon_name = parse_string(doc, m);
+ }
} else if (act->func == action_showmenu) {
if ((n = parse_find_node("menu", node->xmlChildrenNode)))
act->data.showmenu.name = parse_string(doc, n);
g_warning("failed to execute '%s': %s",
cmd, e->message);
g_error_free(e);
- } else {
+ } else if (data->execute.startupnotify) {
gchar **env, *program;
program = g_path_get_basename(argv[0]);
env = sn_get_spawn_environment(program,
+ data->execute.name,
+ data->execute.icon_name,
data->execute.any.time);
if (!g_spawn_async(NULL, argv, env, G_SPAWN_SEARCH_PATH |
G_SPAWN_DO_NOT_REAP_CHILD,
g_strfreev(env);
g_free(program);
g_strfreev(argv);
+ } else {
+ 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",
+ cmd, e->message);
+ g_error_free(e);
+ }
+ g_strfreev(argv);
}
g_free(cmd);
} else {
struct Execute {
struct AnyAction any;
gchar *path;
+ gboolean startupnotify;
+ gchar *name;
+ gchar *icon_name;
};
struct ClientAction {
return CurrentTime;
}
gboolean sn_get_desktop(gchar *id, guint *desktop) { return FALSE; }
-gchar **sn_get_spawn_environment(char *program, Time time)
+gchar **sn_get_spawn_environment(char *program, char *name,
+ char *icon_name, Time time)
{
return g_strdupv(environ);
}
return FALSE; /* don't repeat */
}
-gchar **sn_get_spawn_environment(char *program, Time time)
+gchar **sn_get_spawn_environment(char *program, char *name,
+ char *icon_name, Time time)
{
gchar **env, *desc;
guint len;
sn_launcher = sn_launcher_context_new(sn_display, ob_screen);
}
- sn_launcher_context_set_name(sn_launcher, program);
+ sn_launcher_context_set_name(sn_launcher, name ? name : program);
sn_launcher_context_set_description(sn_launcher, desc);
- sn_launcher_context_set_icon_name(sn_launcher, program);
+ sn_launcher_context_set_icon_name(sn_launcher, icon_name ? icon_name : program);
sn_launcher_context_set_binary_name(sn_launcher, program);
sn_launcher_context_initiate(sn_launcher, "openbox", program, time);
id = sn_launcher_context_get_startup_id(sn_launcher);
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, Time time);
+gchar **sn_get_spawn_environment(char *program, char *name,
+ char *icon_name, Time time);
/* Tell startup notification we're not actually running the program we
told it we were