diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 16:09:27 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 16:09:27 -0400 |
commit | d434da563239c43c5fe417ce83b23b417f2ab635 (patch) | |
tree | e154daaf43c42d11c5afb8b7739ae6b52dd01215 /include/swaybar/status_line.h | |
parent | fix workspace splits (diff) | |
parent | Merge pull request #1699 from acrisci/seat-fixes (diff) | |
download | sway-d434da563239c43c5fe417ce83b23b417f2ab635.tar.gz sway-d434da563239c43c5fe417ce83b23b417f2ab635.tar.zst sway-d434da563239c43c5fe417ce83b23b417f2ab635.zip |
Merge branch 'wlroots' into split-containers
Diffstat (limited to 'include/swaybar/status_line.h')
-rw-r--r-- | include/swaybar/status_line.h | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 6c595df0..3538f49c 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h | |||
@@ -7,10 +7,52 @@ | |||
7 | 7 | ||
8 | enum status_protocol { | 8 | enum status_protocol { |
9 | PROTOCOL_UNDEF, | 9 | PROTOCOL_UNDEF, |
10 | PROTOCOL_ERROR, | ||
10 | PROTOCOL_TEXT, | 11 | PROTOCOL_TEXT, |
11 | PROTOCOL_I3BAR, | 12 | PROTOCOL_I3BAR, |
12 | }; | 13 | }; |
13 | 14 | ||
15 | struct text_protocol_state { | ||
16 | char *buffer; | ||
17 | size_t buffer_size; | ||
18 | }; | ||
19 | |||
20 | enum json_node_type { | ||
21 | JSON_NODE_UNKNOWN, | ||
22 | JSON_NODE_ARRAY, | ||
23 | JSON_NODE_STRING, | ||
24 | }; | ||
25 | |||
26 | struct i3bar_protocol_state { | ||
27 | bool click_events; | ||
28 | char *buffer; | ||
29 | size_t buffer_size; | ||
30 | size_t buffer_index; | ||
31 | const char *current_node; | ||
32 | bool escape; | ||
33 | size_t depth; | ||
34 | enum json_node_type nodes[16]; | ||
35 | }; | ||
36 | |||
37 | struct i3bar_block { | ||
38 | struct wl_list link; | ||
39 | char *full_text, *short_text, *align; | ||
40 | bool urgent; | ||
41 | uint32_t *color; | ||
42 | int min_width; | ||
43 | char *name, *instance; | ||
44 | bool separator; | ||
45 | int separator_block_width; | ||
46 | bool markup; | ||
47 | // Airblader features | ||
48 | uint32_t background; | ||
49 | uint32_t border; | ||
50 | int border_top; | ||
51 | int border_bottom; | ||
52 | int border_left; | ||
53 | int border_right; | ||
54 | }; | ||
55 | |||
14 | struct status_line { | 56 | struct status_line { |
15 | pid_t pid; | 57 | pid_t pid; |
16 | int read_fd, write_fd; | 58 | int read_fd, write_fd; |
@@ -18,13 +60,18 @@ struct status_line { | |||
18 | 60 | ||
19 | enum status_protocol protocol; | 61 | enum status_protocol protocol; |
20 | const char *text; | 62 | const char *text; |
63 | struct wl_list blocks; // i3bar_block::link | ||
21 | 64 | ||
22 | char *buffer; | 65 | struct text_protocol_state text_state; |
23 | size_t buffer_size; | 66 | struct i3bar_protocol_state i3bar_state; |
24 | }; | 67 | }; |
25 | 68 | ||
26 | struct status_line *status_line_init(char *cmd); | 69 | struct status_line *status_line_init(char *cmd); |
70 | void status_error(struct status_line *status, const char *text); | ||
71 | bool status_handle_readable(struct status_line *status); | ||
27 | void status_line_free(struct status_line *status); | 72 | void status_line_free(struct status_line *status); |
28 | bool handle_status_readable(struct status_line *status); | 73 | bool i3bar_handle_readable(struct status_line *status); |
74 | void i3bar_block_send_click(struct status_line *status, | ||
75 | struct i3bar_block *block, int x, int y, uint32_t button); | ||
29 | 76 | ||
30 | #endif | 77 | #endif |