diff options
Diffstat (limited to 'include/swaynag/nagbar.h')
-rw-r--r-- | include/swaynag/nagbar.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/include/swaynag/nagbar.h b/include/swaynag/nagbar.h new file mode 100644 index 00000000..8b55e4fa --- /dev/null +++ b/include/swaynag/nagbar.h | |||
@@ -0,0 +1,115 @@ | |||
1 | #ifndef _SWAY_NAGBAR_NAGBAR_H | ||
2 | #define _SWAY_NAGBAR_NAGNAR_H | ||
3 | #include <stdint.h> | ||
4 | #include "list.h" | ||
5 | #include "pool-buffer.h" | ||
6 | #include "xdg-output-unstable-v1-client-protocol.h" | ||
7 | |||
8 | #define NAGBAR_BAR_BORDER_THICKNESS 2 | ||
9 | #define NAGBAR_MESSAGE_PADDING 8 | ||
10 | #define NAGBAR_DETAILS_BORDER_THICKNESS 3 | ||
11 | #define NAGBAR_BUTTON_BORDER_THICKNESS 3 | ||
12 | #define NAGBAR_BUTTON_GAP 20 | ||
13 | #define NAGBAR_BUTTON_GAP_CLOSE 15 | ||
14 | #define NAGBAR_BUTTON_MARGIN_RIGHT 2 | ||
15 | #define NAGBAR_BUTTON_PADDING 3 | ||
16 | |||
17 | #define NAGBAR_MAX_HEIGHT 500 | ||
18 | |||
19 | enum sway_nagbar_type { | ||
20 | NAGBAR_ERROR, | ||
21 | NAGBAR_WARNING, | ||
22 | }; | ||
23 | |||
24 | enum sway_nagbar_action_type { | ||
25 | NAGBAR_ACTION_DISMISS, | ||
26 | NAGBAR_ACTION_EXPAND, | ||
27 | NAGBAR_ACTION_COMMAND, | ||
28 | }; | ||
29 | |||
30 | struct sway_nagbar_colors { | ||
31 | uint32_t button_background; | ||
32 | uint32_t background; | ||
33 | uint32_t text; | ||
34 | uint32_t border; | ||
35 | uint32_t border_bottom; | ||
36 | }; | ||
37 | |||
38 | struct sway_nagbar_pointer { | ||
39 | struct wl_pointer *pointer; | ||
40 | struct wl_cursor_theme *cursor_theme; | ||
41 | struct wl_cursor_image *cursor_image; | ||
42 | struct wl_surface *cursor_surface; | ||
43 | int x; | ||
44 | int y; | ||
45 | }; | ||
46 | |||
47 | struct sway_nagbar_output { | ||
48 | char *name; | ||
49 | struct wl_output *wl_output; | ||
50 | uint32_t wl_name; | ||
51 | }; | ||
52 | |||
53 | struct sway_nagbar_button { | ||
54 | char *text; | ||
55 | enum sway_nagbar_action_type type; | ||
56 | char *action; | ||
57 | int x; | ||
58 | int y; | ||
59 | int width; | ||
60 | int height; | ||
61 | }; | ||
62 | |||
63 | struct sway_nagbar_details { | ||
64 | bool visible; | ||
65 | char *message; | ||
66 | |||
67 | int x; | ||
68 | int y; | ||
69 | int width; | ||
70 | int height; | ||
71 | |||
72 | int offset; | ||
73 | int visible_lines; | ||
74 | int total_lines; | ||
75 | struct sway_nagbar_button button_up; | ||
76 | struct sway_nagbar_button button_down; | ||
77 | }; | ||
78 | |||
79 | struct sway_nagbar { | ||
80 | bool run_display; | ||
81 | int querying_outputs; | ||
82 | |||
83 | struct wl_display *display; | ||
84 | struct wl_compositor *compositor; | ||
85 | struct wl_seat *seat; | ||
86 | struct wl_shm *shm; | ||
87 | struct sway_nagbar_pointer pointer; | ||
88 | struct zxdg_output_manager_v1 *xdg_output_manager; | ||
89 | struct sway_nagbar_output output; | ||
90 | struct zwlr_layer_shell_v1 *layer_shell; | ||
91 | struct zwlr_layer_surface_v1 *layer_surface; | ||
92 | struct wl_surface *surface; | ||
93 | |||
94 | uint32_t width; | ||
95 | uint32_t height; | ||
96 | int32_t scale; | ||
97 | struct pool_buffer buffers[2]; | ||
98 | struct pool_buffer *current_buffer; | ||
99 | |||
100 | enum sway_nagbar_type type; | ||
101 | struct sway_nagbar_colors colors; | ||
102 | uint32_t anchors; | ||
103 | char *message; | ||
104 | char *font; | ||
105 | list_t *buttons; | ||
106 | struct sway_nagbar_details details; | ||
107 | }; | ||
108 | |||
109 | void nagbar_setup(struct sway_nagbar *nagbar); | ||
110 | |||
111 | void nagbar_run(struct sway_nagbar *nagbar); | ||
112 | |||
113 | void nagbar_destroy(struct sway_nagbar *nagbar); | ||
114 | |||
115 | #endif | ||