diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-07-28 09:34:25 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-01 22:47:54 -0400 |
commit | 8463a2896a932cd99f3dc93608b03cb4aba93293 (patch) | |
tree | b8c4ba994cf4d9ca7510d0f80a1864cce144092a /include/swaynag | |
parent | Address first round review for swaynag (diff) | |
download | sway-8463a2896a932cd99f3dc93608b03cb4aba93293.tar.gz sway-8463a2896a932cd99f3dc93608b03cb4aba93293.tar.zst sway-8463a2896a932cd99f3dc93608b03cb4aba93293.zip |
swaynag: implement config file support
Diffstat (limited to 'include/swaynag')
-rw-r--r-- | include/swaynag/nagbar.h | 20 | ||||
-rw-r--r-- | include/swaynag/types.h | 25 |
2 files changed, 29 insertions, 16 deletions
diff --git a/include/swaynag/nagbar.h b/include/swaynag/nagbar.h index 8b55e4fa..b5d9b2cb 100644 --- a/include/swaynag/nagbar.h +++ b/include/swaynag/nagbar.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef _SWAY_NAGBAR_NAGBAR_H | 1 | #ifndef _SWAY_NAGBAR_NAGBAR_H |
2 | #define _SWAY_NAGBAR_NAGNAR_H | 2 | #define _SWAY_NAGBAR_NAGBAR_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include "list.h" | 4 | #include "list.h" |
5 | #include "pool-buffer.h" | 5 | #include "pool-buffer.h" |
6 | #include "swaynag/types.h" | ||
6 | #include "xdg-output-unstable-v1-client-protocol.h" | 7 | #include "xdg-output-unstable-v1-client-protocol.h" |
7 | 8 | ||
8 | #define NAGBAR_BAR_BORDER_THICKNESS 2 | 9 | #define NAGBAR_BAR_BORDER_THICKNESS 2 |
@@ -16,25 +17,12 @@ | |||
16 | 17 | ||
17 | #define NAGBAR_MAX_HEIGHT 500 | 18 | #define NAGBAR_MAX_HEIGHT 500 |
18 | 19 | ||
19 | enum sway_nagbar_type { | ||
20 | NAGBAR_ERROR, | ||
21 | NAGBAR_WARNING, | ||
22 | }; | ||
23 | |||
24 | enum sway_nagbar_action_type { | 20 | enum sway_nagbar_action_type { |
25 | NAGBAR_ACTION_DISMISS, | 21 | NAGBAR_ACTION_DISMISS, |
26 | NAGBAR_ACTION_EXPAND, | 22 | NAGBAR_ACTION_EXPAND, |
27 | NAGBAR_ACTION_COMMAND, | 23 | NAGBAR_ACTION_COMMAND, |
28 | }; | 24 | }; |
29 | 25 | ||
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 { | 26 | struct sway_nagbar_pointer { |
39 | struct wl_pointer *pointer; | 27 | struct wl_pointer *pointer; |
40 | struct wl_cursor_theme *cursor_theme; | 28 | struct wl_cursor_theme *cursor_theme; |
@@ -72,6 +60,7 @@ struct sway_nagbar_details { | |||
72 | int offset; | 60 | int offset; |
73 | int visible_lines; | 61 | int visible_lines; |
74 | int total_lines; | 62 | int total_lines; |
63 | struct sway_nagbar_button button_details; | ||
75 | struct sway_nagbar_button button_up; | 64 | struct sway_nagbar_button button_up; |
76 | struct sway_nagbar_button button_down; | 65 | struct sway_nagbar_button button_down; |
77 | }; | 66 | }; |
@@ -97,8 +86,7 @@ struct sway_nagbar { | |||
97 | struct pool_buffer buffers[2]; | 86 | struct pool_buffer buffers[2]; |
98 | struct pool_buffer *current_buffer; | 87 | struct pool_buffer *current_buffer; |
99 | 88 | ||
100 | enum sway_nagbar_type type; | 89 | struct sway_nagbar_type *type; |
101 | struct sway_nagbar_colors colors; | ||
102 | uint32_t anchors; | 90 | uint32_t anchors; |
103 | char *message; | 91 | char *message; |
104 | char *font; | 92 | char *font; |
diff --git a/include/swaynag/types.h b/include/swaynag/types.h new file mode 100644 index 00000000..32056514 --- /dev/null +++ b/include/swaynag/types.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _SWAY_NAGBAR_TYPES_H | ||
2 | #define _SWAY_NAGBAR_TYPES_H | ||
3 | |||
4 | struct sway_nagbar_type { | ||
5 | char *name; | ||
6 | uint32_t button_background; | ||
7 | uint32_t background; | ||
8 | uint32_t text; | ||
9 | uint32_t border; | ||
10 | uint32_t border_bottom; | ||
11 | }; | ||
12 | |||
13 | void nagbar_types_add_default(list_t *types); | ||
14 | |||
15 | struct sway_nagbar_type *nagbar_type_get(list_t *types, char *name); | ||
16 | |||
17 | struct sway_nagbar_type *nagbar_type_clone(struct sway_nagbar_type *type); | ||
18 | |||
19 | void nagbar_type_free(struct sway_nagbar_type *type); | ||
20 | |||
21 | void nagbar_types_free(list_t *types); | ||
22 | |||
23 | int nagbar_parse_type(int argc, char **argv, struct sway_nagbar_type *type); | ||
24 | |||
25 | #endif | ||