1 #include "openbox/action.h"
2 #include "openbox/action_list_run.h"
3 #include "openbox/action_value.h"
4 #include "openbox/menu.h"
11 static gpointer setup_func(GHashTable *config);
12 static void free_func(gpointer options);
13 static gboolean run_func(const ObActionListRun *data, gpointer options);
15 void action_showmenu_startup(void)
17 action_register("ShowMenu", OB_ACTION_DEFAULT_FILTER_SINGLE,
18 setup_func, free_func, run_func);
21 static gpointer setup_func(GHashTable *config)
26 o = g_slice_new0(Options);
28 v = g_hash_table_lookup(config, "menu");
29 if (v && action_value_is_string(v))
30 o->name = g_strdup(action_value_string(v));
34 static void free_func(gpointer options)
38 g_slice_free(Options, o);
41 /* Always return FALSE because its not interactive */
42 static gboolean run_func(const ObActionListRun *data, gpointer options)
46 /* you cannot call ShowMenu from inside a menu */
47 if (data->uact != OB_USER_ACTION_MENU_SELECTION && o->name)
48 menu_show(o->name, data->x, data->y, data->button != 0, data->client);