summaryrefslogtreecommitdiffstats
path: root/include/swaybar/bar.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/swaybar/bar.h')
-rw-r--r--include/swaybar/bar.h89
1 files changed, 31 insertions, 58 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 50d36e76..3ae8c0b3 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -1,72 +1,45 @@
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
8struct bar { 7struct swaybar_config;
9 struct config *config; 8struct swaybar_output;
10 struct status_line *status; 9struct swaybar_workspace;
11 list_t *outputs; 10
12 struct output *focused_output; 11struct swaybar {
12 struct wl_display *display;
13 struct wl_compositor *compositor;
14 struct zwlr_layer_shell_v1 *layer_shell;
15 struct wl_shm *shm;
13 16
14 int ipc_event_socketfd; 17 struct swaybar_config *config;
15 int ipc_socketfd; 18 struct swaybar_output *focused_output;
16 int status_read_fd; 19
17 int status_write_fd; 20 struct wl_list outputs;
18 pid_t status_command_pid;
19}; 21};
20 22
21struct output { 23struct swaybar_output {
22 struct window *window; 24 struct wl_list link;
23 struct registry *registry; 25 struct swaybar *bar;
24 list_t *workspaces; 26 struct wl_output *output;
25#ifdef ENABLE_TRAY 27 struct wl_surface *surface;
26 list_t *items; 28 struct zwlr_layer_surface_v1 *layer_surface;
27#endif 29
28 char *name; 30 char *name;
29 int idx; 31 int idx;
30 bool focused; 32 bool focused;
31};
32 33
33struct workspace { 34 uint32_t width, height;
34 int num; 35 struct pool_buffer buffers[2];
35 char *name; 36 struct pool_buffer *current_buffer;
36 bool focused;
37 bool visible;
38 bool urgent;
39}; 37};
40 38
41/** Global bar state */ 39void bar_setup(struct swaybar *bar,
42extern struct bar swaybar; 40 const char *socket_path,
41 const char *bar_id);
42void bar_run(struct swaybar *bar);
43void bar_teardown(struct swaybar *bar);
43 44
44/** True if sway needs to render */ 45#endif
45extern bool dirty;
46
47/**
48 * Setup bar.
49 */
50void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id);
51
52/**
53 * Create new output struct from name.
54 */
55struct output *new_output(const char *name);
56
57/**
58 * Bar mainloop.
59 */
60void bar_run(struct bar *bar);
61
62/**
63 * free workspace list.
64 */
65void free_workspaces(list_t *workspaces);
66
67/**
68 * Teardown bar.
69 */
70void bar_teardown(struct bar *bar);
71
72#endif /* _SWAYBAR_BAR_H */