diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/pango.h | 16 | ||||
-rw-r--r-- | include/sway/commands.h | 4 | ||||
-rw-r--r-- | include/sway/config.h | 46 | ||||
-rw-r--r-- | include/sway/ipc-json.h | 1 | ||||
-rw-r--r-- | include/sway/ipc-server.h | 4 | ||||
-rw-r--r-- | include/sway/layers.h | 2 | ||||
-rw-r--r-- | include/sway/output.h | 1 | ||||
-rw-r--r-- | include/swaybar/bar.h | 89 | ||||
-rw-r--r-- | include/swaybar/config.h | 60 | ||||
-rw-r--r-- | include/swaybar/event_loop.h | 4 | ||||
-rw-r--r-- | include/swaybar/ipc.h | 25 | ||||
-rw-r--r-- | include/swaybar/render.h | 22 | ||||
-rw-r--r-- | include/swaybar/status_line.h | 65 |
13 files changed, 121 insertions, 218 deletions
diff --git a/include/pango.h b/include/pango.h new file mode 100644 index 00000000..f6325f28 --- /dev/null +++ b/include/pango.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _SWAY_PANGO_H | ||
2 | #define _SWAY_PANGO_H | ||
3 | #include <stdarg.h> | ||
4 | #include <stdbool.h> | ||
5 | #include <stdint.h> | ||
6 | #include <cairo/cairo.h> | ||
7 | #include <pango/pangocairo.h> | ||
8 | |||
9 | PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | ||
10 | const char *text, int32_t scale, bool markup); | ||
11 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | ||
12 | int32_t scale, bool markup, const char *fmt, ...); | ||
13 | void pango_printf(cairo_t *cairo, const char *font, | ||
14 | int32_t scale, bool markup, const char *fmt, ...); | ||
15 | |||
16 | #endif | ||
diff --git a/include/sway/commands.h b/include/sway/commands.h index 9ff18823..1291d5fb 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -74,6 +74,9 @@ void free_cmd_results(struct cmd_results *results); | |||
74 | */ | 74 | */ |
75 | const char *cmd_results_to_json(struct cmd_results *results); | 75 | const char *cmd_results_to_json(struct cmd_results *results); |
76 | 76 | ||
77 | struct cmd_results *add_color(const char *name, | ||
78 | char *buffer, const char *color); | ||
79 | |||
77 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | 80 | typedef struct cmd_results *sway_cmd(int argc, char **argv); |
78 | 81 | ||
79 | sway_cmd cmd_assign; | 82 | sway_cmd cmd_assign; |
@@ -138,6 +141,7 @@ sway_cmd cmd_splith; | |||
138 | sway_cmd cmd_splitt; | 141 | sway_cmd cmd_splitt; |
139 | sway_cmd cmd_splitv; | 142 | sway_cmd cmd_splitv; |
140 | sway_cmd cmd_sticky; | 143 | sway_cmd cmd_sticky; |
144 | sway_cmd cmd_swaybg_command; | ||
141 | sway_cmd cmd_unmark; | 145 | sway_cmd cmd_unmark; |
142 | sway_cmd cmd_workspace; | 146 | sway_cmd cmd_workspace; |
143 | sway_cmd cmd_ws_auto_back_and_forth; | 147 | sway_cmd cmd_ws_auto_back_and_forth; |
diff --git a/include/sway/config.h b/include/sway/config.h index 7fdd0be0..ac1105b4 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -1,17 +1,18 @@ | |||
1 | #ifndef _SWAY_CONFIG_H | 1 | #ifndef _SWAY_CONFIG_H |
2 | #define _SWAY_CONFIG_H | 2 | #define _SWAY_CONFIG_H |
3 | |||
4 | #define PID_WORKSPACE_TIMEOUT 60 | 3 | #define PID_WORKSPACE_TIMEOUT 60 |
5 | |||
6 | #include <libinput.h> | 4 | #include <libinput.h> |
7 | #include <stdint.h> | 5 | #include <stdint.h> |
8 | #include <string.h> | 6 | #include <string.h> |
7 | #include <time.h> | ||
9 | #include <wlr/types/wlr_box.h> | 8 | #include <wlr/types/wlr_box.h> |
10 | #include <xkbcommon/xkbcommon.h> | 9 | #include <xkbcommon/xkbcommon.h> |
11 | #include <time.h> | ||
12 | #include "list.h" | 10 | #include "list.h" |
13 | #include "tree/layout.h" | 11 | #include "tree/layout.h" |
14 | #include "tree/container.h" | 12 | #include "tree/container.h" |
13 | #include "wlr-layer-shell-unstable-v1-protocol.h" | ||
14 | |||
15 | // TODO: Refactor this shit | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * Describes a variable created via the `set` command. | 18 | * Describes a variable created via the `set` command. |
@@ -152,24 +153,13 @@ struct bar_config { | |||
152 | char *id; | 153 | char *id; |
153 | uint32_t modifier; | 154 | uint32_t modifier; |
154 | list_t *outputs; | 155 | list_t *outputs; |
155 | //enum desktop_shell_panel_position position; // TODO | 156 | char *position; |
156 | list_t *bindings; | 157 | list_t *bindings; |
157 | char *status_command; | 158 | char *status_command; |
158 | bool pango_markup; | 159 | bool pango_markup; |
159 | char *swaybar_command; | 160 | char *swaybar_command; |
160 | char *font; | 161 | char *font; |
161 | int height; // -1 not defined | 162 | int height; // -1 not defined |
162 | |||
163 | #ifdef ENABLE_TRAY | ||
164 | // Tray | ||
165 | char *tray_output; | ||
166 | char *icon_theme; | ||
167 | uint32_t tray_padding; | ||
168 | uint32_t activate_button; | ||
169 | uint32_t context_button; | ||
170 | uint32_t secondary_button; | ||
171 | #endif | ||
172 | |||
173 | bool workspace_buttons; | 163 | bool workspace_buttons; |
174 | bool wrap_scroll; | 164 | bool wrap_scroll; |
175 | char *separator_symbol; | 165 | char *separator_symbol; |
@@ -292,6 +282,7 @@ struct sway_config { | |||
292 | list_t *active_bar_modifiers; | 282 | list_t *active_bar_modifiers; |
293 | struct sway_mode *current_mode; | 283 | struct sway_mode *current_mode; |
294 | struct bar_config *current_bar; | 284 | struct bar_config *current_bar; |
285 | char *swaybg_command; | ||
295 | uint32_t floating_mod; | 286 | uint32_t floating_mod; |
296 | uint32_t dragging_key; | 287 | uint32_t dragging_key; |
297 | uint32_t resizing_key; | 288 | uint32_t resizing_key; |
@@ -420,11 +411,6 @@ void apply_output_config(struct output_config *oc, | |||
420 | struct sway_container *output); | 411 | struct sway_container *output); |
421 | void free_output_config(struct output_config *oc); | 412 | void free_output_config(struct output_config *oc); |
422 | 413 | ||
423 | /** | ||
424 | * Updates the list of active bar modifiers | ||
425 | */ | ||
426 | void update_active_bar_modifiers(void); | ||
427 | |||
428 | int workspace_output_cmp_workspace(const void *a, const void *b); | 414 | int workspace_output_cmp_workspace(const void *a, const void *b); |
429 | 415 | ||
430 | int sway_binding_cmp(const void *a, const void *b); | 416 | int sway_binding_cmp(const void *a, const void *b); |
@@ -433,27 +419,17 @@ int sway_binding_cmp_keys(const void *a, const void *b); | |||
433 | void free_sway_binding(struct sway_binding *sb); | 419 | void free_sway_binding(struct sway_binding *sb); |
434 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); | 420 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); |
435 | 421 | ||
436 | int sway_mouse_binding_cmp(const void *a, const void *b); | 422 | /* Bar stuff */ |
437 | int sway_mouse_binding_cmp_qsort(const void *a, const void *b); | ||
438 | int sway_mouse_binding_cmp_buttons(const void *a, const void *b); | ||
439 | void free_sway_mouse_binding(struct sway_mouse_binding *smb); | ||
440 | |||
441 | void load_swaybars(); | 423 | void load_swaybars(); |
424 | void invoke_swaybar(struct bar_config *bar); | ||
442 | void terminate_swaybg(pid_t pid); | 425 | void terminate_swaybg(pid_t pid); |
443 | |||
444 | /** | ||
445 | * Allocate and initialize default bar configuration. | ||
446 | */ | ||
447 | struct bar_config *default_bar_config(void); | 426 | struct bar_config *default_bar_config(void); |
427 | void free_bar_config(struct bar_config *bar); | ||
448 | 428 | ||
449 | /** | 429 | /* Global config singleton. */ |
450 | * Global config singleton. | ||
451 | */ | ||
452 | extern struct sway_config *config; | 430 | extern struct sway_config *config; |
453 | 431 | ||
454 | /** | 432 | /* Config file currently being read */ |
455 | * Config file currently being read. | ||
456 | */ | ||
457 | extern const char *current_config_path; | 433 | extern const char *current_config_path; |
458 | 434 | ||
459 | #endif | 435 | #endif |
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 3d2fdc4f..7d87d377 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h | |||
@@ -9,5 +9,6 @@ json_object *ipc_json_get_version(); | |||
9 | json_object *ipc_json_describe_container(struct sway_container *c); | 9 | json_object *ipc_json_describe_container(struct sway_container *c); |
10 | json_object *ipc_json_describe_container_recursive(struct sway_container *c); | 10 | json_object *ipc_json_describe_container_recursive(struct sway_container *c); |
11 | json_object *ipc_json_describe_input(struct sway_input_device *device); | 11 | json_object *ipc_json_describe_input(struct sway_input_device *device); |
12 | json_object *ipc_json_describe_bar_config(struct bar_config *bar); | ||
12 | 13 | ||
13 | #endif | 14 | #endif |
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h index d73006dc..c3389fe8 100644 --- a/include/sway/ipc-server.h +++ b/include/sway/ipc-server.h | |||
@@ -12,6 +12,10 @@ void ipc_terminate(void); | |||
12 | 12 | ||
13 | struct sockaddr_un *ipc_user_sockaddr(void); | 13 | struct sockaddr_un *ipc_user_sockaddr(void); |
14 | 14 | ||
15 | void ipc_event_workspace(struct sway_container *old, | ||
16 | struct sway_container *new, const char *change); | ||
15 | void ipc_event_window(struct sway_container *window, const char *change); | 17 | void ipc_event_window(struct sway_container *window, const char *change); |
18 | void ipc_event_barconfig_update(struct bar_config *bar); | ||
19 | void ipc_event_mode(const char *mode); | ||
16 | 20 | ||
17 | #endif | 21 | #endif |
diff --git a/include/sway/layers.h b/include/sway/layers.h index 22054be1..ee47c5ad 100644 --- a/include/sway/layers.h +++ b/include/sway/layers.h | |||
@@ -14,8 +14,6 @@ struct sway_layer_surface { | |||
14 | struct wl_listener unmap; | 14 | struct wl_listener unmap; |
15 | struct wl_listener surface_commit; | 15 | struct wl_listener surface_commit; |
16 | struct wl_listener output_destroy; | 16 | struct wl_listener output_destroy; |
17 | struct wl_listener output_mode; | ||
18 | struct wl_listener output_transform; | ||
19 | 17 | ||
20 | bool configured; | 18 | bool configured; |
21 | struct wlr_box geo; | 19 | struct wlr_box geo; |
diff --git a/include/sway/output.h b/include/sway/output.h index f899230f..6fb79987 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -21,6 +21,7 @@ struct sway_output { | |||
21 | struct wl_listener frame; | 21 | struct wl_listener frame; |
22 | struct wl_listener destroy; | 22 | struct wl_listener destroy; |
23 | struct wl_listener mode; | 23 | struct wl_listener mode; |
24 | struct wl_listener transform; | ||
24 | 25 | ||
25 | pid_t bg_pid; | 26 | pid_t bg_pid; |
26 | }; | 27 | }; |
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 50d36e76..1bf2ea2d 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -1,36 +1,49 @@ | |||
1 | #ifndef _SWAYBAR_BAR_H | 1 | #ifndef _SWAYBAR_BAR_H |
2 | #define _SWAYBAR_BAR_H | 2 | #define _SWAYBAR_BAR_H |
3 | 3 | #include <wayland-client.h> | |
4 | #include "client/registry.h" | 4 | #include "pool-buffer.h" |
5 | #include "client/window.h" | ||
6 | #include "list.h" | 5 | #include "list.h" |
7 | 6 | ||
8 | struct bar { | 7 | struct swaybar_config; |
9 | struct config *config; | 8 | struct swaybar_output; |
9 | struct swaybar_workspace; | ||
10 | |||
11 | struct swaybar { | ||
12 | struct wl_display *display; | ||
13 | struct wl_compositor *compositor; | ||
14 | struct zwlr_layer_shell_v1 *layer_shell; | ||
15 | struct wl_shm *shm; | ||
16 | |||
17 | struct swaybar_config *config; | ||
18 | struct swaybar_output *focused_output; | ||
10 | struct status_line *status; | 19 | struct status_line *status; |
11 | list_t *outputs; | ||
12 | struct output *focused_output; | ||
13 | 20 | ||
14 | int ipc_event_socketfd; | 21 | int ipc_event_socketfd; |
15 | int ipc_socketfd; | 22 | int ipc_socketfd; |
16 | int status_read_fd; | 23 | |
17 | int status_write_fd; | 24 | struct wl_list outputs; |
18 | pid_t status_command_pid; | ||
19 | }; | 25 | }; |
20 | 26 | ||
21 | struct output { | 27 | struct swaybar_output { |
22 | struct window *window; | 28 | struct wl_list link; |
23 | struct registry *registry; | 29 | struct swaybar *bar; |
24 | list_t *workspaces; | 30 | struct wl_output *output; |
25 | #ifdef ENABLE_TRAY | 31 | struct wl_surface *surface; |
26 | list_t *items; | 32 | struct zwlr_layer_surface_v1 *layer_surface; |
27 | #endif | 33 | |
34 | struct wl_list workspaces; | ||
35 | |||
28 | char *name; | 36 | char *name; |
29 | int idx; | 37 | size_t index; |
30 | bool focused; | 38 | bool focused; |
39 | |||
40 | uint32_t width, height; | ||
41 | struct pool_buffer buffers[2]; | ||
42 | struct pool_buffer *current_buffer; | ||
31 | }; | 43 | }; |
32 | 44 | ||
33 | struct workspace { | 45 | struct swaybar_workspace { |
46 | struct wl_list link; | ||
34 | int num; | 47 | int num; |
35 | char *name; | 48 | char *name; |
36 | bool focused; | 49 | bool focused; |
@@ -38,35 +51,11 @@ struct workspace { | |||
38 | bool urgent; | 51 | bool urgent; |
39 | }; | 52 | }; |
40 | 53 | ||
41 | /** Global bar state */ | 54 | // TODO: Rename stuff to match wlroots conventions (init/create/etc) |
42 | extern struct bar swaybar; | 55 | void bar_setup(struct swaybar *bar, |
56 | const char *socket_path, | ||
57 | const char *bar_id); | ||
58 | void bar_run(struct swaybar *bar); | ||
59 | void bar_teardown(struct swaybar *bar); | ||
43 | 60 | ||
44 | /** True if sway needs to render */ | 61 | #endif |
45 | extern bool dirty; | ||
46 | |||
47 | /** | ||
48 | * Setup bar. | ||
49 | */ | ||
50 | void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id); | ||
51 | |||
52 | /** | ||
53 | * Create new output struct from name. | ||
54 | */ | ||
55 | struct output *new_output(const char *name); | ||
56 | |||
57 | /** | ||
58 | * Bar mainloop. | ||
59 | */ | ||
60 | void bar_run(struct bar *bar); | ||
61 | |||
62 | /** | ||
63 | * free workspace list. | ||
64 | */ | ||
65 | void free_workspaces(list_t *workspaces); | ||
66 | |||
67 | /** | ||
68 | * Teardown bar. | ||
69 | */ | ||
70 | void bar_teardown(struct bar *bar); | ||
71 | |||
72 | #endif /* _SWAYBAR_BAR_H */ | ||
diff --git a/include/swaybar/config.h b/include/swaybar/config.h index 651f0ee3..7634cb16 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h | |||
@@ -1,49 +1,35 @@ | |||
1 | #ifndef _SWAYBAR_CONFIG_H | 1 | #ifndef _SWAYBAR_CONFIG_H |
2 | #define _SWAYBAR_CONFIG_H | 2 | #define _SWAYBAR_CONFIG_H |
3 | |||
4 | #include <stdint.h> | ||
5 | #include <stdbool.h> | 3 | #include <stdbool.h> |
6 | 4 | #include <stdint.h> | |
7 | #include "list.h" | 5 | #include <wayland-client.h> |
8 | #include "util.h" | 6 | #include "util.h" |
9 | 7 | ||
10 | /** | ||
11 | * Colors for a box with background, border and text colors. | ||
12 | */ | ||
13 | struct box_colors { | 8 | struct box_colors { |
14 | uint32_t border; | 9 | uint32_t border; |
15 | uint32_t background; | 10 | uint32_t background; |
16 | uint32_t text; | 11 | uint32_t text; |
17 | }; | 12 | }; |
18 | 13 | ||
19 | /** | 14 | struct config_output { |
20 | * Swaybar config. | 15 | struct wl_list link; |
21 | */ | 16 | char *name; |
22 | struct config { | 17 | size_t index; |
18 | }; | ||
19 | |||
20 | struct swaybar_config { | ||
23 | char *status_command; | 21 | char *status_command; |
24 | bool pango_markup; | 22 | bool pango_markup; |
25 | uint32_t position; | 23 | uint32_t position; // zwlr_layer_surface_v1_anchor |
26 | char *font; | 24 | char *font; |
27 | char *sep_symbol; | 25 | char *sep_symbol; |
28 | char *mode; | 26 | char *mode; |
27 | bool mode_pango_markup; | ||
29 | bool strip_workspace_numbers; | 28 | bool strip_workspace_numbers; |
30 | bool binding_mode_indicator; | 29 | bool binding_mode_indicator; |
31 | bool wrap_scroll; | 30 | bool wrap_scroll; |
32 | bool workspace_buttons; | 31 | bool workspace_buttons; |
33 | bool all_outputs; | 32 | struct wl_list outputs; |
34 | list_t *outputs; | ||
35 | |||
36 | #ifdef ENABLE_TRAY | ||
37 | // Tray | ||
38 | char *tray_output; | ||
39 | char *icon_theme; | ||
40 | |||
41 | uint32_t tray_padding; | ||
42 | uint32_t activate_button; | ||
43 | uint32_t context_button; | ||
44 | uint32_t secondary_button; | ||
45 | #endif | ||
46 | |||
47 | int height; | 33 | int height; |
48 | 34 | ||
49 | struct { | 35 | struct { |
@@ -63,24 +49,8 @@ struct config { | |||
63 | } colors; | 49 | } colors; |
64 | }; | 50 | }; |
65 | 51 | ||
66 | /** | 52 | struct swaybar_config *init_config(); |
67 | * Parse position top|bottom|left|right. | 53 | void free_config(struct swaybar_config *config); |
68 | */ | ||
69 | uint32_t parse_position(const char *position); | 54 | uint32_t parse_position(const char *position); |
70 | 55 | ||
71 | /** | 56 | #endif |
72 | * Parse font. | ||
73 | */ | ||
74 | char *parse_font(const char *font); | ||
75 | |||
76 | /** | ||
77 | * Initialize default sway config. | ||
78 | */ | ||
79 | struct config *init_config(); | ||
80 | |||
81 | /** | ||
82 | * Free config struct. | ||
83 | */ | ||
84 | void free_config(struct config *config); | ||
85 | |||
86 | #endif /* _SWAYBAR_CONFIG_H */ | ||
diff --git a/include/swaybar/event_loop.h b/include/swaybar/event_loop.h index a0cde07f..99f6ed36 100644 --- a/include/swaybar/event_loop.h +++ b/include/swaybar/event_loop.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _SWAYBAR_EVENT_LOOP_H | 1 | #ifndef _SWAYBAR_EVENT_LOOP_H |
2 | #define _SWAYBAR_EVENT_LOOP_H | 2 | #define _SWAYBAR_EVENT_LOOP_H |
3 | |||
4 | #include <stdbool.h> | 3 | #include <stdbool.h> |
5 | #include <time.h> | 4 | #include <time.h> |
6 | 5 | ||
@@ -23,4 +22,5 @@ bool remove_timer(timer_t timer); | |||
23 | void event_loop_poll(); | 22 | void event_loop_poll(); |
24 | 23 | ||
25 | void init_event_loop(); | 24 | void init_event_loop(); |
26 | #endif /*_SWAYBAR_EVENT_LOOP_H */ | 25 | |
26 | #endif | ||
diff --git a/include/swaybar/ipc.h b/include/swaybar/ipc.h index c11931d0..278baef0 100644 --- a/include/swaybar/ipc.h +++ b/include/swaybar/ipc.h | |||
@@ -1,23 +1,10 @@ | |||
1 | #ifndef _SWAYBAR_IPC_H | 1 | #ifndef _SWAYBAR_IPC_H |
2 | #define _SWAYBAR_IPC_H | 2 | #define _SWAYBAR_IPC_H |
3 | #include <stdbool.h> | ||
4 | #include "swaybar/bar.h" | ||
3 | 5 | ||
4 | #include "bar.h" | 6 | void ipc_initialize(struct swaybar *bar, const char *bar_id); |
5 | 7 | bool handle_ipc_event(struct swaybar *bar); | |
6 | /** | 8 | void ipc_get_workspaces(struct swaybar *bar); |
7 | * Initialize ipc connection to sway and get sway state, outputs, bar_config. | ||
8 | */ | ||
9 | void ipc_bar_init(struct bar *bar, const char *bar_id); | ||
10 | |||
11 | /** | ||
12 | * Handle ipc event from sway. | ||
13 | */ | ||
14 | bool handle_ipc_event(struct bar *bar); | ||
15 | |||
16 | |||
17 | /** | ||
18 | * Send workspace command to sway | ||
19 | */ | ||
20 | void ipc_send_workspace_command(const char *workspace_name); | ||
21 | |||
22 | #endif /* _SWAYBAR_IPC_H */ | ||
23 | 9 | ||
10 | #endif | ||
diff --git a/include/swaybar/render.h b/include/swaybar/render.h index 114f43f4..071e2298 100644 --- a/include/swaybar/render.h +++ b/include/swaybar/render.h | |||
@@ -1,22 +1,10 @@ | |||
1 | #ifndef _SWAYBAR_RENDER_H | 1 | #ifndef _SWAYBAR_RENDER_H |
2 | #define _SWAYBAR_RENDER_H | 2 | #define _SWAYBAR_RENDER_H |
3 | 3 | ||
4 | #include "config.h" | 4 | struct swaybar; |
5 | #include "bar.h" | 5 | struct swaybar_output; |
6 | struct swaybar_config; | ||
6 | 7 | ||
7 | /** | 8 | void render_frame(struct swaybar *bar, struct swaybar_output *output); |
8 | * Render swaybar. | ||
9 | */ | ||
10 | void render(struct output *output, struct config *config, struct status_line *line); | ||
11 | 9 | ||
12 | /** | 10 | #endif |
13 | * Set window height and modify internal spacing accordingly. | ||
14 | */ | ||
15 | void set_window_height(struct window *window, int height); | ||
16 | |||
17 | /** | ||
18 | * Compute the size of a workspace name | ||
19 | */ | ||
20 | void workspace_button_size(struct window *window, const char *workspace_name, int *width, int *height); | ||
21 | |||
22 | #endif /* _SWAYBAR_RENDER_H */ | ||
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 0664ddee..6c595df0 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h | |||
@@ -1,61 +1,30 @@ | |||
1 | #ifndef _SWAYBAR_STATUS_LINE_H | 1 | #ifndef _SWAYBAR_STATUS_LINE_H |
2 | #define _SWAYBAR_STATUS_LINE_H | 2 | #define _SWAYBAR_STATUS_LINE_H |
3 | |||
4 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <stdio.h> | ||
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | |||
7 | #include "list.h" | ||
8 | #include "bar.h" | 6 | #include "bar.h" |
9 | 7 | ||
10 | typedef enum {UNDEF, TEXT, I3BAR} command_protocol; | 8 | enum status_protocol { |
9 | PROTOCOL_UNDEF, | ||
10 | PROTOCOL_TEXT, | ||
11 | PROTOCOL_I3BAR, | ||
12 | }; | ||
11 | 13 | ||
12 | struct status_line { | 14 | struct status_line { |
13 | list_t *block_line; | 15 | pid_t pid; |
14 | const char *text_line; | 16 | int read_fd, write_fd; |
15 | command_protocol protocol; | 17 | FILE *read, *write; |
16 | bool click_events; | ||
17 | }; | ||
18 | 18 | ||
19 | struct status_block { | 19 | enum status_protocol protocol; |
20 | char *full_text, *short_text, *align; | 20 | const char *text; |
21 | bool urgent; | ||
22 | uint32_t color; | ||
23 | int min_width; | ||
24 | char *name, *instance; | ||
25 | bool separator; | ||
26 | int separator_block_width; | ||
27 | bool markup; | ||
28 | // Airblader features | ||
29 | uint32_t background; | ||
30 | uint32_t border; | ||
31 | int border_top; | ||
32 | int border_bottom; | ||
33 | int border_left; | ||
34 | int border_right; | ||
35 | 21 | ||
36 | // Set during rendering | 22 | char *buffer; |
37 | int x; | 23 | size_t buffer_size; |
38 | int width; | ||
39 | }; | 24 | }; |
40 | 25 | ||
41 | /** | 26 | struct status_line *status_line_init(char *cmd); |
42 | * Initialize status line struct. | 27 | void status_line_free(struct status_line *status); |
43 | */ | 28 | bool handle_status_readable(struct status_line *status); |
44 | struct status_line *init_status_line(); | ||
45 | |||
46 | /** | ||
47 | * handle status line activity. | ||
48 | */ | ||
49 | bool handle_status_line(struct bar *bar); | ||
50 | |||
51 | /** | ||
52 | * Handle mouse clicks. | ||
53 | */ | ||
54 | bool status_line_mouse_event(struct bar *bar, int x, int y, uint32_t button); | ||
55 | |||
56 | /** | ||
57 | * Free status line struct. | ||
58 | */ | ||
59 | void free_status_line(struct status_line *line); | ||
60 | 29 | ||
61 | #endif /* _SWAYBAR_STATUS_LINE_H */ | 30 | #endif |