1 #include "openbox/action.h"
2 #include "openbox/action_list_run.h"
3 #include "openbox/client.h"
4 #include "openbox/client_set.h"
5 #include "openbox/screen.h"
7 static gboolean run_func_on(const ObClientSet *set,
8 const ObActionListRun *data, gpointer options);
9 static gboolean run_func_off(const ObClientSet *set,
10 const ObActionListRun *data, gpointer options);
11 static gboolean run_func_toggle(const ObClientSet *set,
12 const ObActionListRun *data, gpointer options);
14 void action_omnipresent_startup(void)
16 action_register("Omnipresent", OB_ACTION_DEFAULT_FILTER_SINGLE,
17 NULL, NULL, run_func_on);
18 action_register("Unomnipresent", OB_ACTION_DEFAULT_FILTER_SINGLE,
19 NULL, NULL, run_func_off);
20 action_register("ToggleOmnipresent", OB_ACTION_DEFAULT_FILTER_SINGLE,
21 NULL, NULL, run_func_toggle);
24 static gboolean each_off(ObClient *c, const ObActionListRun *data,
27 client_set_desktop(c, FALSE, FALSE, TRUE);
31 /* Always return FALSE because its not interactive */
32 static gboolean run_func_off(const ObClientSet *set,
33 const ObActionListRun *data, gpointer options)
35 if (!client_set_is_empty(set)) {
36 action_client_move(data, TRUE);
37 client_set_run(set, data, each_off, options);
38 action_client_move(data, FALSE);
43 static gboolean each_on(ObClient *c, const ObActionListRun *data,
46 client_set_desktop(c, TRUE, FALSE, TRUE);
50 /* Always return FALSE because its not interactive */
51 static gboolean run_func_on(const ObClientSet *set,
52 const ObActionListRun *data, gpointer options)
54 if (!client_set_is_empty(set)) {
55 action_client_move(data, TRUE);
56 client_set_run(set, data, each_on, options);
57 action_client_move(data, FALSE);
62 static gboolean each_toggle(ObClient *c, const ObActionListRun *data,
65 gboolean omni = c->desktop == DESKTOP_ALL ? screen_desktop : DESKTOP_ALL;
66 client_set_desktop(c, omni, FALSE, TRUE);
70 /* Always return FALSE because its not interactive */
71 static gboolean run_func_toggle(const ObClientSet *set,
72 const ObActionListRun *data, gpointer options)
74 if (!client_set_is_empty(set)) {
75 action_client_move(data, TRUE);
76 client_set_run(set, data, each_toggle, options);
77 action_client_move(data, FALSE);