1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
3 #include "openbox/client.h"
13 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
14 static void free_func(gpointer options);
15 static gboolean run_func(ObActionsData *data, gpointer options);
17 void action_desktop_startup()
19 actions_register("Desktop",
26 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
31 o = g_new0(Options, 1);
34 if ((n = parse_find_node("desktop", node))) {
35 gchar *s = parse_string(doc, n);
36 if (!g_ascii_strcasecmp(s, "last"))
39 o->desktop = parse_int(doc, n) - 1;
42 if ((n = parse_find_node("send", node)))
43 o->send = parse_bool(doc, n);
44 if ((n = parse_find_node("follow", node)))
45 o->follow = parse_bool(doc, n);
50 static void free_func(gpointer options)
57 /* Always return FALSE because its not interactive */
58 static gboolean run_func(ObActionsData *data, gpointer options)
64 d = screen_last_desktop;
68 if (d < screen_num_desktops && d != screen_desktop) {
69 gboolean go = !o->send;
71 if (data->client && client_normal(data->client)) {
72 client_set_desktop(data->client, d, o->follow, FALSE);
77 screen_set_desktop(d, TRUE);