diff options
Diffstat (limited to 'include/swaybar')
-rw-r--r-- | include/swaybar/bar.h | 7 | ||||
-rw-r--r-- | include/swaybar/config.h | 2 | ||||
-rw-r--r-- | include/swaybar/i3bar.h | 34 | ||||
-rw-r--r-- | include/swaybar/ipc.h | 2 | ||||
-rw-r--r-- | include/swaybar/render.h | 4 | ||||
-rw-r--r-- | include/swaybar/status_line.h | 27 | ||||
-rw-r--r-- | include/swaybar/tray/dbus.h | 18 | ||||
-rw-r--r-- | include/swaybar/tray/sni_watcher.h | 10 | ||||
-rw-r--r-- | include/swaybar/tray/tray.h | 32 |
9 files changed, 41 insertions, 95 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 29e96159..de234111 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -54,7 +54,6 @@ struct swaybar { | |||
54 | struct wl_seat *seat; | 54 | struct wl_seat *seat; |
55 | 55 | ||
56 | struct swaybar_config *config; | 56 | struct swaybar_config *config; |
57 | struct swaybar_output *focused_output; | ||
58 | struct swaybar_pointer pointer; | 57 | struct swaybar_pointer pointer; |
59 | struct status_line *status; | 58 | struct status_line *status; |
60 | 59 | ||
@@ -84,6 +83,8 @@ struct swaybar_output { | |||
84 | enum wl_output_subpixel subpixel; | 83 | enum wl_output_subpixel subpixel; |
85 | struct pool_buffer buffers[2]; | 84 | struct pool_buffer buffers[2]; |
86 | struct pool_buffer *current_buffer; | 85 | struct pool_buffer *current_buffer; |
86 | bool dirty; | ||
87 | bool frame_scheduled; | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | struct swaybar_workspace { | 90 | struct swaybar_workspace { |
@@ -95,9 +96,7 @@ struct swaybar_workspace { | |||
95 | bool urgent; | 96 | bool urgent; |
96 | }; | 97 | }; |
97 | 98 | ||
98 | void bar_setup(struct swaybar *bar, | 99 | bool bar_setup(struct swaybar *bar, const char *socket_path, const char *bar_id); |
99 | const char *socket_path, | ||
100 | const char *bar_id); | ||
101 | void bar_run(struct swaybar *bar); | 100 | void bar_run(struct swaybar *bar); |
102 | void bar_teardown(struct swaybar *bar); | 101 | void bar_teardown(struct swaybar *bar); |
103 | 102 | ||
diff --git a/include/swaybar/config.h b/include/swaybar/config.h index 6739c28a..5f5688cf 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h | |||
@@ -50,7 +50,7 @@ struct swaybar_config { | |||
50 | } colors; | 50 | } colors; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct swaybar_config *init_config(); | 53 | struct swaybar_config *init_config(void); |
54 | void free_config(struct swaybar_config *config); | 54 | void free_config(struct swaybar_config *config); |
55 | uint32_t parse_position(const char *position); | 55 | uint32_t parse_position(const char *position); |
56 | 56 | ||
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h new file mode 100644 index 00000000..12d9b317 --- /dev/null +++ b/include/swaybar/i3bar.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _SWAYBAR_I3BAR_H | ||
2 | #define _SWAYBAR_I3BAR_H | ||
3 | |||
4 | #include "bar.h" | ||
5 | #include "status_line.h" | ||
6 | |||
7 | struct i3bar_block { | ||
8 | struct wl_list link; | ||
9 | int ref_count; | ||
10 | char *full_text, *short_text, *align; | ||
11 | bool urgent; | ||
12 | uint32_t *color; | ||
13 | int min_width; | ||
14 | char *name, *instance; | ||
15 | bool separator; | ||
16 | int separator_block_width; | ||
17 | bool markup; | ||
18 | // Airblader features | ||
19 | uint32_t background; | ||
20 | uint32_t border; | ||
21 | int border_top; | ||
22 | int border_bottom; | ||
23 | int border_left; | ||
24 | int border_right; | ||
25 | }; | ||
26 | |||
27 | void i3bar_block_unref(struct i3bar_block *block); | ||
28 | bool i3bar_handle_readable(struct status_line *status); | ||
29 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | ||
30 | struct i3bar_block *block, int x, int y, enum x11_button button); | ||
31 | enum x11_button wl_button_to_x11_button(uint32_t button); | ||
32 | enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value); | ||
33 | |||
34 | #endif | ||
diff --git a/include/swaybar/ipc.h b/include/swaybar/ipc.h index a1696bcf..81e48a6b 100644 --- a/include/swaybar/ipc.h +++ b/include/swaybar/ipc.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include "swaybar/bar.h" | 4 | #include "swaybar/bar.h" |
5 | 5 | ||
6 | void ipc_initialize(struct swaybar *bar, const char *bar_id); | 6 | bool ipc_initialize(struct swaybar *bar, const char *bar_id); |
7 | bool handle_ipc_readable(struct swaybar *bar); | 7 | bool handle_ipc_readable(struct swaybar *bar); |
8 | void ipc_get_workspaces(struct swaybar *bar); | 8 | void ipc_get_workspaces(struct swaybar *bar); |
9 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws); | 9 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws); |
diff --git a/include/swaybar/render.h b/include/swaybar/render.h index 071e2298..ebdc69e4 100644 --- a/include/swaybar/render.h +++ b/include/swaybar/render.h | |||
@@ -1,10 +1,8 @@ | |||
1 | #ifndef _SWAYBAR_RENDER_H | 1 | #ifndef _SWAYBAR_RENDER_H |
2 | #define _SWAYBAR_RENDER_H | 2 | #define _SWAYBAR_RENDER_H |
3 | 3 | ||
4 | struct swaybar; | ||
5 | struct swaybar_output; | 4 | struct swaybar_output; |
6 | struct swaybar_config; | ||
7 | 5 | ||
8 | void render_frame(struct swaybar *bar, struct swaybar_output *output); | 6 | void render_frame(struct swaybar_output *output); |
9 | 7 | ||
10 | #endif | 8 | #endif |
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index d3eabdf6..ca88b0c5 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h | |||
@@ -13,26 +13,6 @@ enum status_protocol { | |||
13 | PROTOCOL_I3BAR, | 13 | PROTOCOL_I3BAR, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | struct i3bar_block { | ||
17 | struct wl_list link; | ||
18 | int ref_count; | ||
19 | char *full_text, *short_text, *align; | ||
20 | bool urgent; | ||
21 | uint32_t *color; | ||
22 | int min_width; | ||
23 | char *name, *instance; | ||
24 | bool separator; | ||
25 | int separator_block_width; | ||
26 | bool markup; | ||
27 | // Airblader features | ||
28 | uint32_t background; | ||
29 | uint32_t border; | ||
30 | int border_top; | ||
31 | int border_bottom; | ||
32 | int border_left; | ||
33 | int border_right; | ||
34 | }; | ||
35 | |||
36 | struct status_line { | 16 | struct status_line { |
37 | pid_t pid; | 17 | pid_t pid; |
38 | int read_fd, write_fd; | 18 | int read_fd, write_fd; |
@@ -43,6 +23,7 @@ struct status_line { | |||
43 | struct wl_list blocks; // i3bar_block::link | 23 | struct wl_list blocks; // i3bar_block::link |
44 | 24 | ||
45 | bool click_events; | 25 | bool click_events; |
26 | bool clicked; | ||
46 | char *buffer; | 27 | char *buffer; |
47 | size_t buffer_size; | 28 | size_t buffer_size; |
48 | size_t buffer_index; | 29 | size_t buffer_index; |
@@ -55,11 +36,5 @@ struct status_line *status_line_init(char *cmd); | |||
55 | void status_error(struct status_line *status, const char *text); | 36 | void status_error(struct status_line *status, const char *text); |
56 | bool status_handle_readable(struct status_line *status); | 37 | bool status_handle_readable(struct status_line *status); |
57 | void status_line_free(struct status_line *status); | 38 | void status_line_free(struct status_line *status); |
58 | bool i3bar_handle_readable(struct status_line *status); | ||
59 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | ||
60 | struct i3bar_block *block, int x, int y, enum x11_button button); | ||
61 | void i3bar_block_unref(struct i3bar_block *block); | ||
62 | enum x11_button wl_button_to_x11_button(uint32_t button); | ||
63 | enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value); | ||
64 | 39 | ||
65 | #endif | 40 | #endif |
diff --git a/include/swaybar/tray/dbus.h b/include/swaybar/tray/dbus.h deleted file mode 100644 index eb9cfea7..00000000 --- a/include/swaybar/tray/dbus.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef _SWAYBAR_DBUS_H | ||
2 | #define _SWAYBAR_DBUS_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <dbus/dbus.h> | ||
6 | extern DBusConnection *conn; | ||
7 | |||
8 | /** | ||
9 | * Should be called in main loop to dispatch events | ||
10 | */ | ||
11 | void dispatch_dbus(); | ||
12 | |||
13 | /** | ||
14 | * Initializes async dbus communication | ||
15 | */ | ||
16 | int dbus_init(); | ||
17 | |||
18 | #endif /* _SWAYBAR_DBUS_H */ | ||
diff --git a/include/swaybar/tray/sni_watcher.h b/include/swaybar/tray/sni_watcher.h deleted file mode 100644 index 25ddfcd2..00000000 --- a/include/swaybar/tray/sni_watcher.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef _SWAYBAR_SNI_WATCHER_H | ||
2 | #define _SWAYBAR_SNI_WATCHER_H | ||
3 | |||
4 | /** | ||
5 | * Starts the sni_watcher, the watcher is practically a black box and should | ||
6 | * only be accessed though functions described in its spec | ||
7 | */ | ||
8 | int init_sni_watcher(); | ||
9 | |||
10 | #endif /* _SWAYBAR_SNI_WATCHER_H */ | ||
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h deleted file mode 100644 index 2d0662be..00000000 --- a/include/swaybar/tray/tray.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #ifndef _SWAYBAR_TRAY_H | ||
2 | #define _SWAYBAR_TRAY_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | #include <stdbool.h> | ||
6 | #include "swaybar/tray/dbus.h" | ||
7 | #include "swaybar/tray/sni.h" | ||
8 | #include "swaybar/bar.h" | ||
9 | #include "list.h" | ||
10 | |||
11 | extern struct tray *tray; | ||
12 | |||
13 | struct tray { | ||
14 | list_t *items; | ||
15 | }; | ||
16 | |||
17 | /** | ||
18 | * Processes a mouse event on the bar | ||
19 | */ | ||
20 | void tray_mouse_event(struct output *output, int x, int y, | ||
21 | uint32_t button, uint32_t state); | ||
22 | |||
23 | uint32_t tray_render(struct output *output, struct config *config); | ||
24 | |||
25 | void tray_upkeep(struct bar *bar); | ||
26 | |||
27 | /** | ||
28 | * Initializes the tray with D-Bus | ||
29 | */ | ||
30 | void init_tray(struct bar *bar); | ||
31 | |||
32 | #endif /* _SWAYBAR_TRAY_H */ | ||