6 static GSList *hooks[OB_NUM_HOOKS];
8 void hooks_startup(gboolean reconfig)
12 for (i = 0; i < OB_NUM_HOOKS; ++i)
16 void hooks_shutdown(gboolean reconfig)
20 for (i = 0; i < OB_NUM_HOOKS; ++i)
22 actions_act_unref(hooks[i]->data);
23 hooks[i] = g_slist_delete_link(hooks[i], hooks[i]);
27 ObHook hooks_hook_from_name(const gchar *n)
29 if (!g_ascii_strcasecmp(n, "WindowNew"))
30 return OB_HOOK_WIN_NEW;
31 if (!g_ascii_strcasecmp(n, "WindowClosed"))
32 return OB_HOOK_WIN_CLOSE;
33 if (!g_ascii_strcasecmp(n, "WindowVisible"))
34 return OB_HOOK_WIN_VISIBLE;
35 if (!g_ascii_strcasecmp(n, "WindowInvisible"))
36 return OB_HOOK_WIN_INVISIBLE;
37 if (!g_ascii_strcasecmp(n, "WindowIconified"))
38 return OB_HOOK_WIN_ICONIC;
39 if (!g_ascii_strcasecmp(n, "WindowUniconified"))
40 return OB_HOOK_WIN_UNICONIC;
41 if (!g_ascii_strcasecmp(n, "WindowMaximized"))
42 return OB_HOOK_WIN_MAX;
43 if (!g_ascii_strcasecmp(n, "WindowUnmaximized"))
44 return OB_HOOK_WIN_UNMAX;
45 if (!g_ascii_strcasecmp(n, "WindowShaded"))
46 return OB_HOOK_WIN_SHADE;
47 if (!g_ascii_strcasecmp(n, "WindowUnshaded"))
48 return OB_HOOK_WIN_UNSHADE;
49 if (!g_ascii_strcasecmp(n, "WindowFocused"))
50 return OB_HOOK_WIN_FOCUS;
51 if (!g_ascii_strcasecmp(n, "WindowUnfocused"))
52 return OB_HOOK_WIN_UNFOCUS;
53 if (!g_ascii_strcasecmp(n, "WindowOnNewDesktop"))
54 return OB_HOOK_WIN_DESK_CHANGE;
55 if (!g_ascii_strcasecmp(n, "WindowDecorated"))
56 return OB_HOOK_WIN_DECORATED;
57 if (!g_ascii_strcasecmp(n, "WindowUndecorated"))
58 return OB_HOOK_WIN_UNDECORATED;
59 if (!g_ascii_strcasecmp(n, "DesktopChanged"))
60 return OB_HOOK_SCREEN_DESK_CHANGE;
61 return OB_HOOK_INVALID;
64 void hooks_run(ObHook hook, struct _ObClient *c)
68 g_assert(hook < OB_NUM_HOOKS);
70 actions_run_acts(hooks[hook],
73 OB_FRAME_CONTEXT_NONE,
77 void hooks_add(ObHook hook, struct _ObActionsAct *act)
79 g_assert(hook < OB_NUM_HOOKS);
81 /* append so they are executed in the same order as they appear in the
83 hooks[hook] = g_slist_append(hooks[hook], act);