]> icculus.org git repositories - mikachu/openbox.git/blob - plugins/menu/client_menu.c
Client menus
[mikachu/openbox.git] / plugins / menu / client_menu.c
1 #include <glib.h>
2
3 #include "kernel/menu.h"
4 #include "kernel/screen.h"
5
6 static char *PLUGIN_NAME = "client_menu";
7 static Menu *send_to_menu;
8
9 typedef struct {
10
11 } Client_Menu_Data;
12
13 #define CLIENT_MENU(m) ((Menu *)m)
14 #define CLIENT_MENU_DATA(m) ((Client_Menu_Data *)((Menu *)m)->plugin_data)
15
16
17 void client_menu_clean_up(Menu *m) {
18 }
19
20 void client_send_to_update(Menu *self)
21 {
22     guint i;
23     g_message("yo!");
24     
25     for (i = 0; i < screen_num_desktops; ++i) {
26         MenuEntry *e;
27         Action *a = action_from_string("sendtodesktop");
28         a->data.sendto.desk = i;
29         a->data.sendto.follow = FALSE;
30         e = menu_entry_new(screen_desktop_names[i], a);
31         menu_add_entry(self, e);
32     }
33
34     menu_render_full(self);
35 }
36
37 void plugin_setup_config() { }
38
39 void plugin_shutdown() { }
40
41 void plugin_destroy (Menu *m)
42 {
43 }
44
45 void *plugin_create() /* TODO: need config */
46 {
47     Menu *m = menu_new(NULL, "client-menu", NULL);
48     menu_add_entry(m, menu_entry_new_submenu("Send To Workspace",
49                                              send_to_menu));
50     send_to_menu->parent = m;
51
52     menu_add_entry(m, menu_entry_new("Iconify",
53                                      action_from_string("iconify")));
54     menu_add_entry(m, menu_entry_new("Raise",
55                                      action_from_string("raise")));
56     menu_add_entry(m, menu_entry_new("Lower",
57                                      action_from_string("lower")));
58     menu_add_entry(m, menu_entry_new("Close",
59                                      action_from_string("close")));
60     menu_add_entry(m, menu_entry_new("Shade",
61                                      action_from_string("toggleshade")));
62     menu_add_entry(m, menu_entry_new("Omnipresent",
63                                      action_from_string("toggleomnipresent")));
64
65     /* send to desktop
66        iconify
67        raise
68        lower
69        close
70        kill
71        shade
72        omnipresent
73        decorations
74     */
75     return (void *)m;
76 }
77
78 void plugin_startup()
79 {
80     Menu *t;
81     /* create a Send To Workspace Menu */
82     send_to_menu = menu_new_full("Send To Workspace", "send-to-workspace",
83                           NULL, NULL, client_send_to_update);
84
85     t = (Menu *)plugin_create("client_menu");
86 }
87