diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/commands.h | 9 | ||||
-rw-r--r-- | include/sway/config.h | 13 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 4 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 6 | ||||
-rw-r--r-- | include/sway/input/seat.h | 6 | ||||
-rw-r--r-- | include/swaybar/bar.h | 12 | ||||
-rw-r--r-- | include/swaybar/config.h | 9 | ||||
-rw-r--r-- | include/swaybar/tray/host.h | 17 | ||||
-rw-r--r-- | include/swaybar/tray/icon.h | 52 | ||||
-rw-r--r-- | include/swaybar/tray/item.h | 45 | ||||
-rw-r--r-- | include/swaybar/tray/sni.h | 82 | ||||
-rw-r--r-- | include/swaybar/tray/tray.h | 40 | ||||
-rw-r--r-- | include/swaybar/tray/watcher.h | 18 |
13 files changed, 212 insertions, 101 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 89e18c66..7d0ff838 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -133,7 +133,6 @@ sway_cmd cmd_force_display_urgency_hint; | |||
133 | sway_cmd cmd_force_focus_wrapping; | 133 | sway_cmd cmd_force_focus_wrapping; |
134 | sway_cmd cmd_fullscreen; | 134 | sway_cmd cmd_fullscreen; |
135 | sway_cmd cmd_gaps; | 135 | sway_cmd cmd_gaps; |
136 | sway_cmd cmd_hide_cursor; | ||
137 | sway_cmd cmd_hide_edge_borders; | 136 | sway_cmd cmd_hide_edge_borders; |
138 | sway_cmd cmd_include; | 137 | sway_cmd cmd_include; |
139 | sway_cmd cmd_input; | 138 | sway_cmd cmd_input; |
@@ -173,6 +172,7 @@ sway_cmd cmd_swaybg_command; | |||
173 | sway_cmd cmd_swaynag_command; | 172 | sway_cmd cmd_swaynag_command; |
174 | sway_cmd cmd_swap; | 173 | sway_cmd cmd_swap; |
175 | sway_cmd cmd_tiling_drag; | 174 | sway_cmd cmd_tiling_drag; |
175 | sway_cmd cmd_tiling_drag_threshold; | ||
176 | sway_cmd cmd_title_align; | 176 | sway_cmd cmd_title_align; |
177 | sway_cmd cmd_title_format; | 177 | sway_cmd cmd_title_format; |
178 | sway_cmd cmd_titlebar_border_thickness; | 178 | sway_cmd cmd_titlebar_border_thickness; |
@@ -183,11 +183,9 @@ sway_cmd cmd_workspace; | |||
183 | sway_cmd cmd_ws_auto_back_and_forth; | 183 | sway_cmd cmd_ws_auto_back_and_forth; |
184 | sway_cmd cmd_workspace_layout; | 184 | sway_cmd cmd_workspace_layout; |
185 | 185 | ||
186 | sway_cmd bar_cmd_activate_button; | ||
187 | sway_cmd bar_cmd_binding_mode_indicator; | 186 | sway_cmd bar_cmd_binding_mode_indicator; |
188 | sway_cmd bar_cmd_bindsym; | 187 | sway_cmd bar_cmd_bindsym; |
189 | sway_cmd bar_cmd_colors; | 188 | sway_cmd bar_cmd_colors; |
190 | sway_cmd bar_cmd_context_button; | ||
191 | sway_cmd bar_cmd_font; | 189 | sway_cmd bar_cmd_font; |
192 | sway_cmd bar_cmd_gaps; | 190 | sway_cmd bar_cmd_gaps; |
193 | sway_cmd bar_cmd_mode; | 191 | sway_cmd bar_cmd_mode; |
@@ -198,13 +196,13 @@ sway_cmd bar_cmd_hidden_state; | |||
198 | sway_cmd bar_cmd_icon_theme; | 196 | sway_cmd bar_cmd_icon_theme; |
199 | sway_cmd bar_cmd_id; | 197 | sway_cmd bar_cmd_id; |
200 | sway_cmd bar_cmd_position; | 198 | sway_cmd bar_cmd_position; |
201 | sway_cmd bar_cmd_secondary_button; | ||
202 | sway_cmd bar_cmd_separator_symbol; | 199 | sway_cmd bar_cmd_separator_symbol; |
203 | sway_cmd bar_cmd_status_command; | 200 | sway_cmd bar_cmd_status_command; |
204 | sway_cmd bar_cmd_pango_markup; | 201 | sway_cmd bar_cmd_pango_markup; |
205 | sway_cmd bar_cmd_strip_workspace_numbers; | 202 | sway_cmd bar_cmd_strip_workspace_numbers; |
206 | sway_cmd bar_cmd_strip_workspace_name; | 203 | sway_cmd bar_cmd_strip_workspace_name; |
207 | sway_cmd bar_cmd_swaybar_command; | 204 | sway_cmd bar_cmd_swaybar_command; |
205 | sway_cmd bar_cmd_tray_bindsym; | ||
208 | sway_cmd bar_cmd_tray_output; | 206 | sway_cmd bar_cmd_tray_output; |
209 | sway_cmd bar_cmd_tray_padding; | 207 | sway_cmd bar_cmd_tray_padding; |
210 | sway_cmd bar_cmd_wrap_scroll; | 208 | sway_cmd bar_cmd_wrap_scroll; |
@@ -260,8 +258,9 @@ sway_cmd output_cmd_scale; | |||
260 | sway_cmd output_cmd_transform; | 258 | sway_cmd output_cmd_transform; |
261 | 259 | ||
262 | sway_cmd seat_cmd_attach; | 260 | sway_cmd seat_cmd_attach; |
263 | sway_cmd seat_cmd_fallback; | ||
264 | sway_cmd seat_cmd_cursor; | 261 | sway_cmd seat_cmd_cursor; |
262 | sway_cmd seat_cmd_fallback; | ||
263 | sway_cmd seat_cmd_hide_cursor; | ||
265 | 264 | ||
266 | sway_cmd cmd_ipc_cmd; | 265 | sway_cmd cmd_ipc_cmd; |
267 | sway_cmd cmd_ipc_events; | 266 | sway_cmd cmd_ipc_events; |
diff --git a/include/sway/config.h b/include/sway/config.h index 6610f009..ebf16e6a 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/types/wlr_box.h> | 7 | #include <wlr/types/wlr_box.h> |
8 | #include <xkbcommon/xkbcommon.h> | 8 | #include <xkbcommon/xkbcommon.h> |
9 | #include "../include/config.h" | ||
9 | #include "list.h" | 10 | #include "list.h" |
10 | #include "swaynag.h" | 11 | #include "swaynag.h" |
11 | #include "tree/container.h" | 12 | #include "tree/container.h" |
@@ -140,6 +141,7 @@ struct seat_config { | |||
140 | char *name; | 141 | char *name; |
141 | int fallback; // -1 means not set | 142 | int fallback; // -1 means not set |
142 | list_t *attachments; // list of seat_attachment configs | 143 | list_t *attachments; // list of seat_attachment configs |
144 | int hide_cursor_timeout; | ||
143 | }; | 145 | }; |
144 | 146 | ||
145 | enum config_dpms { | 147 | enum config_dpms { |
@@ -252,6 +254,13 @@ struct bar_config { | |||
252 | char *binding_mode_bg; | 254 | char *binding_mode_bg; |
253 | char *binding_mode_text; | 255 | char *binding_mode_text; |
254 | } colors; | 256 | } colors; |
257 | |||
258 | #if HAVE_TRAY | ||
259 | char *icon_theme; | ||
260 | const char *tray_bindings[10]; // mouse buttons 0-9 | ||
261 | list_t *tray_outputs; // char * | ||
262 | int tray_padding; | ||
263 | #endif | ||
255 | }; | 264 | }; |
256 | 265 | ||
257 | struct bar_binding { | 266 | struct bar_binding { |
@@ -417,7 +426,9 @@ struct sway_config { | |||
417 | bool auto_back_and_forth; | 426 | bool auto_back_and_forth; |
418 | bool show_marks; | 427 | bool show_marks; |
419 | enum alignment title_align; | 428 | enum alignment title_align; |
429 | |||
420 | bool tiling_drag; | 430 | bool tiling_drag; |
431 | int tiling_drag_threshold; | ||
421 | 432 | ||
422 | bool smart_gaps; | 433 | bool smart_gaps; |
423 | int gaps_inner; | 434 | int gaps_inner; |
@@ -436,8 +447,6 @@ struct sway_config { | |||
436 | enum edge_border_types hide_edge_borders; | 447 | enum edge_border_types hide_edge_borders; |
437 | enum edge_border_types saved_edge_borders; | 448 | enum edge_border_types saved_edge_borders; |
438 | 449 | ||
439 | int hide_cursor_timeout; | ||
440 | |||
441 | // border colors | 450 | // border colors |
442 | struct { | 451 | struct { |
443 | struct border_colors focused; | 452 | struct border_colors focused; |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 21a26f68..22e278b0 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -60,6 +60,10 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | |||
60 | */ | 60 | */ |
61 | void cursor_rebase(struct sway_cursor *cursor); | 61 | void cursor_rebase(struct sway_cursor *cursor); |
62 | 62 | ||
63 | void cursor_handle_activity(struct sway_cursor *cursor); | ||
64 | void cursor_unhide(struct sway_cursor *cursor); | ||
65 | int cursor_get_timeout(struct sway_cursor *cursor); | ||
66 | |||
63 | /** | 67 | /** |
64 | * Like cursor_rebase, but also allows focus to change when the cursor enters a | 68 | * Like cursor_rebase, but also allows focus to change when the cursor enters a |
65 | * new container. | 69 | * new container. |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 219aa9ba..08e749dc 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -44,6 +44,12 @@ struct sway_seat *input_manager_get_default_seat(void); | |||
44 | struct sway_seat *input_manager_get_seat(const char *seat_name); | 44 | struct sway_seat *input_manager_get_seat(const char *seat_name); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * If none of the seat configs have a fallback setting (either true or false), | ||
48 | * create the default seat (if needed) and set it as the fallback | ||
49 | */ | ||
50 | void input_manager_verify_fallback_seat(void); | ||
51 | |||
52 | /** | ||
47 | * Gets the last seat the user interacted with | 53 | * Gets the last seat the user interacted with |
48 | */ | 54 | */ |
49 | struct sway_seat *input_manager_current_seat(void); | 55 | struct sway_seat *input_manager_current_seat(void); |
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index bef2af77..a3c20346 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -39,6 +39,7 @@ enum sway_seat_operation { | |||
39 | OP_NONE, | 39 | OP_NONE, |
40 | OP_DOWN, | 40 | OP_DOWN, |
41 | OP_MOVE_FLOATING, | 41 | OP_MOVE_FLOATING, |
42 | OP_MOVE_TILING_THRESHOLD, | ||
42 | OP_MOVE_TILING, | 43 | OP_MOVE_TILING, |
43 | OP_RESIZE_FLOATING, | 44 | OP_RESIZE_FLOATING, |
44 | OP_RESIZE_TILING, | 45 | OP_RESIZE_TILING, |
@@ -174,6 +175,8 @@ void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); | |||
174 | 175 | ||
175 | struct seat_config *seat_get_config(struct sway_seat *seat); | 176 | struct seat_config *seat_get_config(struct sway_seat *seat); |
176 | 177 | ||
178 | struct seat_config *seat_get_config_by_name(const char *name); | ||
179 | |||
177 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 180 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
178 | 181 | ||
179 | void drag_icon_update_position(struct sway_drag_icon *icon); | 182 | void drag_icon_update_position(struct sway_drag_icon *icon); |
@@ -184,6 +187,9 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | |||
184 | void seat_begin_move_floating(struct sway_seat *seat, | 187 | void seat_begin_move_floating(struct sway_seat *seat, |
185 | struct sway_container *con, uint32_t button); | 188 | struct sway_container *con, uint32_t button); |
186 | 189 | ||
190 | void seat_begin_move_tiling_threshold(struct sway_seat *seat, | ||
191 | struct sway_container *con, uint32_t button); | ||
192 | |||
187 | void seat_begin_move_tiling(struct sway_seat *seat, | 193 | void seat_begin_move_tiling(struct sway_seat *seat, |
188 | struct sway_container *con, uint32_t button); | 194 | struct sway_container *con, uint32_t button); |
189 | 195 | ||
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 57c5114e..e377b8de 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAYBAR_BAR_H | 1 | #ifndef _SWAYBAR_BAR_H |
2 | #define _SWAYBAR_BAR_H | 2 | #define _SWAYBAR_BAR_H |
3 | #include <wayland-client.h> | 3 | #include <wayland-client.h> |
4 | #include "config.h" | ||
4 | #include "input.h" | 5 | #include "input.h" |
5 | #include "pool-buffer.h" | 6 | #include "pool-buffer.h" |
6 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 7 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
@@ -8,6 +9,9 @@ | |||
8 | 9 | ||
9 | struct swaybar_config; | 10 | struct swaybar_config; |
10 | struct swaybar_output; | 11 | struct swaybar_output; |
12 | #if HAVE_TRAY | ||
13 | struct swaybar_tray; | ||
14 | #endif | ||
11 | struct swaybar_workspace; | 15 | struct swaybar_workspace; |
12 | struct loop; | 16 | struct loop; |
13 | 17 | ||
@@ -38,6 +42,10 @@ struct swaybar { | |||
38 | int ipc_socketfd; | 42 | int ipc_socketfd; |
39 | 43 | ||
40 | struct wl_list outputs; // swaybar_output::link | 44 | struct wl_list outputs; // swaybar_output::link |
45 | |||
46 | #if HAVE_TRAY | ||
47 | struct swaybar_tray *tray; | ||
48 | #endif | ||
41 | }; | 49 | }; |
42 | 50 | ||
43 | struct swaybar_output { | 51 | struct swaybar_output { |
@@ -62,6 +70,8 @@ struct swaybar_output { | |||
62 | struct pool_buffer *current_buffer; | 70 | struct pool_buffer *current_buffer; |
63 | bool dirty; | 71 | bool dirty; |
64 | bool frame_scheduled; | 72 | bool frame_scheduled; |
73 | |||
74 | uint32_t output_height, output_width, output_x, output_y; | ||
65 | }; | 75 | }; |
66 | 76 | ||
67 | struct swaybar_workspace { | 77 | struct swaybar_workspace { |
@@ -78,6 +88,8 @@ bool bar_setup(struct swaybar *bar, const char *socket_path); | |||
78 | void bar_run(struct swaybar *bar); | 88 | void bar_run(struct swaybar *bar); |
79 | void bar_teardown(struct swaybar *bar); | 89 | void bar_teardown(struct swaybar *bar); |
80 | 90 | ||
91 | void set_bar_dirty(struct swaybar *bar); | ||
92 | |||
81 | /* | 93 | /* |
82 | * Determines whether the bar should be visible and changes it to be so. | 94 | * Determines whether the bar should be visible and changes it to be so. |
83 | * If the current visibility of the bar is the different to what it should be, | 95 | * If the current visibility of the bar is the different to what it should be, |
diff --git a/include/swaybar/config.h b/include/swaybar/config.h index fd7c6ec4..1f6577bd 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <wayland-client.h> | 5 | #include <wayland-client.h> |
6 | #include "../include/config.h" | ||
6 | #include "list.h" | 7 | #include "list.h" |
7 | #include "util.h" | 8 | #include "util.h" |
8 | 9 | ||
@@ -64,6 +65,14 @@ struct swaybar_config { | |||
64 | struct box_colors urgent_workspace; | 65 | struct box_colors urgent_workspace; |
65 | struct box_colors binding_mode; | 66 | struct box_colors binding_mode; |
66 | } colors; | 67 | } colors; |
68 | |||
69 | #if HAVE_TRAY | ||
70 | char *icon_theme; | ||
71 | char *tray_bindings[10]; // mouse buttons 0-9 | ||
72 | bool tray_hidden; | ||
73 | list_t *tray_outputs; // char * | ||
74 | int tray_padding; | ||
75 | #endif | ||
67 | }; | 76 | }; |
68 | 77 | ||
69 | struct swaybar_config *init_config(void); | 78 | struct swaybar_config *init_config(void); |
diff --git a/include/swaybar/tray/host.h b/include/swaybar/tray/host.h new file mode 100644 index 00000000..2d4cf82b --- /dev/null +++ b/include/swaybar/tray/host.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_HOST_H | ||
2 | #define _SWAYBAR_TRAY_HOST_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | |||
6 | struct swaybar_tray; | ||
7 | |||
8 | struct swaybar_host { | ||
9 | struct swaybar_tray *tray; | ||
10 | char *service; | ||
11 | char *watcher_interface; | ||
12 | }; | ||
13 | |||
14 | bool init_host(struct swaybar_host *host, char *protocol, struct swaybar_tray *tray); | ||
15 | void finish_host(struct swaybar_host *host); | ||
16 | |||
17 | #endif | ||
diff --git a/include/swaybar/tray/icon.h b/include/swaybar/tray/icon.h index 1cc6ff9c..7a6c400c 100644 --- a/include/swaybar/tray/icon.h +++ b/include/swaybar/tray/icon.h | |||
@@ -1,16 +1,44 @@ | |||
1 | #ifndef _SWAYBAR_ICON_H | 1 | #ifndef _SWAYBAR_TRAY_ICON_H |
2 | #define _SWAYBAR_ICON_H | 2 | #define _SWAYBAR_TRAY_ICON_H |
3 | 3 | ||
4 | #include <stdint.h> | 4 | #include "list.h" |
5 | #include <stdbool.h> | ||
6 | #include <client/cairo.h> | ||
7 | 5 | ||
8 | /** | 6 | enum subdir_type { |
9 | * Returns the image found by `name` that is closest to `size` | 7 | THRESHOLD, |
10 | */ | 8 | SCALABLE, |
11 | cairo_surface_t *find_icon(const char *name, int size); | 9 | FIXED |
10 | }; | ||
11 | |||
12 | struct icon_theme_subdir { | ||
13 | char *name; | ||
14 | int size; | ||
15 | enum subdir_type type; | ||
16 | int max_size; | ||
17 | int min_size; | ||
18 | int threshold; | ||
19 | }; | ||
20 | |||
21 | struct icon_theme { | ||
22 | char *name; | ||
23 | char *comment; | ||
24 | char *inherits; | ||
25 | list_t *directories; // char * | ||
12 | 26 | ||
13 | /* Struct used internally only */ | 27 | char *dir; |
14 | struct subdir; | 28 | list_t *subdirs; // struct icon_theme_subdir * |
29 | }; | ||
30 | |||
31 | void init_themes(list_t **themes, list_t **basedirs); | ||
32 | void finish_themes(list_t *themes, list_t *basedirs); | ||
33 | |||
34 | /* | ||
35 | * Finds an icon of a specified size given a list of themes and base directories. | ||
36 | * If the icon is found, the pointers min_size & max_size are set to minimum & | ||
37 | * maximum size that the icon can be scaled to, respectively. | ||
38 | * Returns: path of icon (which should be freed), or NULL if the icon is not found. | ||
39 | */ | ||
40 | char *find_icon(list_t *themes, list_t *basedirs, char *name, int size, | ||
41 | char *theme, int *min_size, int *max_size); | ||
42 | char *find_icon_in_dir(char *name, char *dir, int *min_size, int *max_size); | ||
15 | 43 | ||
16 | #endif /* _SWAYBAR_ICON_H */ | 44 | #endif |
diff --git a/include/swaybar/tray/item.h b/include/swaybar/tray/item.h new file mode 100644 index 00000000..9bba7951 --- /dev/null +++ b/include/swaybar/tray/item.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_ITEM_H | ||
2 | #define _SWAYBAR_TRAY_ITEM_H | ||
3 | |||
4 | #include <cairo.h> | ||
5 | #include <stdbool.h> | ||
6 | #include <stdint.h> | ||
7 | #include "swaybar/tray/tray.h" | ||
8 | #include "list.h" | ||
9 | |||
10 | struct swaybar_output; | ||
11 | |||
12 | struct swaybar_pixmap { | ||
13 | int size; | ||
14 | unsigned char pixels[]; | ||
15 | }; | ||
16 | |||
17 | struct swaybar_sni { | ||
18 | // icon properties | ||
19 | struct swaybar_tray *tray; | ||
20 | cairo_surface_t *icon; | ||
21 | int min_size; | ||
22 | int max_size; | ||
23 | |||
24 | // dbus properties | ||
25 | char *watcher_id; | ||
26 | char *service; | ||
27 | char *path; | ||
28 | char *interface; | ||
29 | |||
30 | char *status; | ||
31 | char *icon_name; | ||
32 | list_t *icon_pixmap; // struct swaybar_pixmap * | ||
33 | char *attention_icon_name; | ||
34 | list_t *attention_icon_pixmap; // struct swaybar_pixmap * | ||
35 | bool item_is_menu; | ||
36 | char *menu; | ||
37 | char *icon_theme_path; // non-standard KDE property | ||
38 | }; | ||
39 | |||
40 | struct swaybar_sni *create_sni(char *id, struct swaybar_tray *tray); | ||
41 | void destroy_sni(struct swaybar_sni *sni); | ||
42 | uint32_t render_sni(cairo_t *cairo, struct swaybar_output *output, double *x, | ||
43 | struct swaybar_sni *sni); | ||
44 | |||
45 | #endif | ||
diff --git a/include/swaybar/tray/sni.h b/include/swaybar/tray/sni.h deleted file mode 100644 index c2544e2a..00000000 --- a/include/swaybar/tray/sni.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | #ifndef _SWAYBAR_SNI_H | ||
2 | #define _SWAYBAR_SNI_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <client/cairo.h> | ||
6 | |||
7 | struct StatusNotifierItem { | ||
8 | /* Name registered to sni watcher */ | ||
9 | char *name; | ||
10 | /* Unique bus name, needed for determining signal origins */ | ||
11 | char *unique_name; | ||
12 | bool kde_special_snowflake; | ||
13 | |||
14 | cairo_surface_t *image; | ||
15 | bool dirty; | ||
16 | }; | ||
17 | |||
18 | /* Each output holds an sni_icon_ref of each item to render */ | ||
19 | struct sni_icon_ref { | ||
20 | cairo_surface_t *icon; | ||
21 | struct StatusNotifierItem *ref; | ||
22 | }; | ||
23 | |||
24 | struct sni_icon_ref *sni_icon_ref_create(struct StatusNotifierItem *item, | ||
25 | int height); | ||
26 | |||
27 | void sni_icon_ref_free(struct sni_icon_ref *sni_ref); | ||
28 | |||
29 | /** | ||
30 | * Will return a new item and get its icon. (see warning below) | ||
31 | * May return `NULL` if `name` is not valid. | ||
32 | */ | ||
33 | struct StatusNotifierItem *sni_create(const char *name); | ||
34 | |||
35 | /** | ||
36 | * `item` must be a struct StatusNotifierItem * | ||
37 | * `str` must be a NUL terminated char * | ||
38 | * | ||
39 | * Returns 0 if `item` has a name of `str` | ||
40 | */ | ||
41 | int sni_str_cmp(const void *item, const void *str); | ||
42 | |||
43 | /** | ||
44 | * Returns 0 if `item` has a unique name of `str` or if | ||
45 | * `item->unique_name == NULL` | ||
46 | */ | ||
47 | int sni_uniq_cmp(const void *item, const void *str); | ||
48 | |||
49 | /** | ||
50 | * Gets an icon for the given item if found. | ||
51 | * | ||
52 | * XXX | ||
53 | * This function keeps a reference to the item until it gets responses, make | ||
54 | * sure that the reference and item are valid during this time. | ||
55 | */ | ||
56 | void get_icon(struct StatusNotifierItem *item); | ||
57 | |||
58 | /** | ||
59 | * Calls the "activate" method on the given StatusNotifierItem | ||
60 | * | ||
61 | * x and y should be where the item was clicked | ||
62 | */ | ||
63 | void sni_activate(struct StatusNotifierItem *item, uint32_t x, uint32_t y); | ||
64 | |||
65 | /** | ||
66 | * Asks the item to draw a context menu at the given x and y coords | ||
67 | */ | ||
68 | void sni_context_menu(struct StatusNotifierItem *item, uint32_t x, uint32_t y); | ||
69 | |||
70 | /** | ||
71 | * Calls the "secondary activate" method on the given StatusNotifierItem | ||
72 | * | ||
73 | * x and y should be where the item was clicked | ||
74 | */ | ||
75 | void sni_secondary(struct StatusNotifierItem *item, uint32_t x, uint32_t y); | ||
76 | |||
77 | /** | ||
78 | * Deconstructs `item` | ||
79 | */ | ||
80 | void sni_free(struct StatusNotifierItem *item); | ||
81 | |||
82 | #endif /* _SWAYBAR_SNI_H */ | ||
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h new file mode 100644 index 00000000..8958b69a --- /dev/null +++ b/include/swaybar/tray/tray.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_TRAY_H | ||
2 | #define _SWAYBAR_TRAY_TRAY_H | ||
3 | |||
4 | #include "config.h" | ||
5 | #ifdef HAVE_SYSTEMD | ||
6 | #include <systemd/sd-bus.h> | ||
7 | #elif HAVE_ELOGIND | ||
8 | #include <elogind/sd-bus.h> | ||
9 | #endif | ||
10 | #include <cairo.h> | ||
11 | #include <stdint.h> | ||
12 | #include "swaybar/tray/host.h" | ||
13 | #include "list.h" | ||
14 | |||
15 | struct swaybar; | ||
16 | struct swaybar_output; | ||
17 | struct swaybar_watcher; | ||
18 | |||
19 | struct swaybar_tray { | ||
20 | struct swaybar *bar; | ||
21 | |||
22 | int fd; | ||
23 | sd_bus *bus; | ||
24 | |||
25 | struct swaybar_host host_xdg; | ||
26 | struct swaybar_host host_kde; | ||
27 | list_t *items; // struct swaybar_sni * | ||
28 | struct swaybar_watcher *watcher_xdg; | ||
29 | struct swaybar_watcher *watcher_kde; | ||
30 | |||
31 | list_t *basedirs; // char * | ||
32 | list_t *themes; // struct swaybar_theme * | ||
33 | }; | ||
34 | |||
35 | struct swaybar_tray *create_tray(struct swaybar *bar); | ||
36 | void destroy_tray(struct swaybar_tray *tray); | ||
37 | void tray_in(int fd, short mask, void *data); | ||
38 | uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x); | ||
39 | |||
40 | #endif | ||
diff --git a/include/swaybar/tray/watcher.h b/include/swaybar/tray/watcher.h new file mode 100644 index 00000000..8f276da8 --- /dev/null +++ b/include/swaybar/tray/watcher.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_WATCHER_H | ||
2 | #define _SWAYBAR_TRAY_WATCHER_H | ||
3 | |||
4 | #include "swaybar/tray/tray.h" | ||
5 | #include "list.h" | ||
6 | |||
7 | struct swaybar_watcher { | ||
8 | char *interface; | ||
9 | sd_bus *bus; | ||
10 | list_t *hosts; | ||
11 | list_t *items; | ||
12 | int version; | ||
13 | }; | ||
14 | |||
15 | struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus); | ||
16 | void destroy_watcher(struct swaybar_watcher *watcher); | ||
17 | |||
18 | #endif | ||