aboutsummaryrefslogtreecommitdiff
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, 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 @@
#ifndef _SWAYBAR_BAR_H
#define _SWAYBAR_BAR_H
-
-#include "client/registry.h"
-#include "client/window.h"
+#include <wayland-client.h>
+#include "pool-buffer.h"
#include "list.h"
-struct bar {
- struct config *config;
+struct swaybar_config;
+struct swaybar_output;
+struct swaybar_workspace;
+
+struct swaybar {
+ struct wl_display *display;
+ struct wl_compositor *compositor;
+ struct zwlr_layer_shell_v1 *layer_shell;
+ struct wl_shm *shm;
+
+ struct swaybar_config *config;
+ struct swaybar_output *focused_output;
struct status_line *status;
- list_t *outputs;
- struct output *focused_output;
int ipc_event_socketfd;
int ipc_socketfd;
- int status_read_fd;
- int status_write_fd;
- pid_t status_command_pid;
+
+ struct wl_list outputs;
};
-struct output {
- struct window *window;
- struct registry *registry;
- list_t *workspaces;
-#ifdef ENABLE_TRAY
- list_t *items;
-#endif
+struct swaybar_output {
+ struct wl_list link;
+ struct swaybar *bar;
+ struct wl_output *output;
+ struct wl_surface *surface;
+ struct zwlr_layer_surface_v1 *layer_surface;
+
+ struct wl_list workspaces;
+
char *name;
- int idx;
+ size_t index;
bool focused;
+
+ uint32_t width, height;
+ struct pool_buffer buffers[2];
+ struct pool_buffer *current_buffer;
};
-struct workspace {
+struct swaybar_workspace {
+ struct wl_list link;
int num;
char *name;
bool focused;
@@ -38,35 +51,11 @@ struct workspace {
bool urgent;
};
-/** Global bar state */
-extern struct bar swaybar;
+// TODO: Rename stuff to match wlroots conventions (init/create/etc)
+void bar_setup(struct swaybar *bar,
+ const char *socket_path,
+ const char *bar_id);
+void bar_run(struct swaybar *bar);
+void bar_teardown(struct swaybar *bar);
-/** True if sway needs to render */
-extern bool dirty;
-
-/**
- * Setup bar.
- */
-void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id);
-
-/**
- * Create new output struct from name.
- */
-struct output *new_output(const char *name);
-
-/**
- * Bar mainloop.
- */
-void bar_run(struct bar *bar);
-
-/**
- * free workspace list.
- */
-void free_workspaces(list_t *workspaces);
-
-/**
- * Teardown bar.
- */
-void bar_teardown(struct bar *bar);
-
-#endif /* _SWAYBAR_BAR_H */
+#endif