diff options
author | 2018-03-30 00:11:00 -0400 | |
---|---|---|
committer | 2018-03-30 00:11:00 -0400 | |
commit | 9d7f47746cdcb0eed3cf41875d06a8ef238eef1c (patch) | |
tree | 997658454de40db3f8b76b68d658efaf2b686188 /include/swaybar/bar.h | |
parent | Merge pull request #1654 from acrisci/refactor-2-electric-boogaloo (diff) | |
parent | Merge remote-tracking branch 'origin/wlroots' into swaybar-layers (diff) | |
download | sway-9d7f47746cdcb0eed3cf41875d06a8ef238eef1c.tar.gz sway-9d7f47746cdcb0eed3cf41875d06a8ef238eef1c.tar.zst sway-9d7f47746cdcb0eed3cf41875d06a8ef238eef1c.zip |
Merge pull request #1648 from swaywm/swaybar-layers
Port swaybar to layer shell
Diffstat (limited to 'include/swaybar/bar.h')
-rw-r--r-- | include/swaybar/bar.h | 89 |
1 files changed, 39 insertions, 50 deletions
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 */ | ||