aboutsummaryrefslogtreecommitdiffstats
path: root/include/swaynagbar/nagbar.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/swaynagbar/nagbar.h')
-rw-r--r--include/swaynagbar/nagbar.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/include/swaynagbar/nagbar.h b/include/swaynagbar/nagbar.h
new file mode 100644
index 00000000..07a0d51e
--- /dev/null
+++ b/include/swaynagbar/nagbar.h
@@ -0,0 +1,88 @@
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_BUTTON_BORDER_THICKNESS 3
11#define NAGBAR_BUTTON_GAP 20
12#define NAGBAR_BUTTON_GAP_CLOSE 15
13#define NAGBAR_BUTTON_MARGIN_RIGHT 2
14#define NAGBAR_BUTTON_PADDING 3
15
16enum sway_nagbar_type {
17 NAGBAR_ERROR,
18 NAGBAR_WARNING,
19};
20
21struct sway_nagbar_colors {
22 uint32_t button_background;
23 uint32_t background;
24 uint32_t text;
25 uint32_t border;
26 uint32_t border_bottom;
27};
28
29struct sway_nagbar_pointer {
30 struct wl_pointer *pointer;
31 struct wl_cursor_theme *cursor_theme;
32 struct wl_cursor_image *cursor_image;
33 struct wl_surface *cursor_surface;
34 int x;
35 int y;
36};
37
38struct sway_nagbar_output {
39 char *name;
40 struct wl_output *wl_output;
41 uint32_t wl_name;
42};
43
44struct sway_nagbar_button {
45 char *text;
46 char *action;
47 int x;
48 int y;
49 int width;
50 int height;
51};
52
53struct sway_nagbar {
54 bool run_display;
55 int querying_outputs;
56
57 struct wl_display *display;
58 struct wl_compositor *compositor;
59 struct wl_seat *seat;
60 struct wl_shm *shm;
61 struct sway_nagbar_pointer pointer;
62 struct zxdg_output_manager_v1 *xdg_output_manager;
63 struct sway_nagbar_output output;
64 struct zwlr_layer_shell_v1 *layer_shell;
65 struct zwlr_layer_surface_v1 *layer_surface;
66 struct wl_surface *surface;
67
68 uint32_t width;
69 uint32_t height;
70 int32_t scale;
71 struct pool_buffer buffers[2];
72 struct pool_buffer *current_buffer;
73
74 enum sway_nagbar_type type;
75 struct sway_nagbar_colors colors;
76 uint32_t anchors;
77 char *message;
78 char *font;
79 list_t *buttons;
80};
81
82void nagbar_setup(struct sway_nagbar *nagbar);
83
84void nagbar_run(struct sway_nagbar *nagbar);
85
86void nagbar_destroy(struct sway_nagbar *nagbar);
87
88#endif