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.h110
1 files changed, 60 insertions, 50 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 50d36e76..0037190b 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -1,36 +1,71 @@
#ifndef _SWAYBAR_BAR_H
#define _SWAYBAR_BAR_H
+#include <wayland-client.h>
+#include "pool-buffer.h"
-#include "client/registry.h"
-#include "client/window.h"
-#include "list.h"
+struct swaybar_config;
+struct swaybar_output;
+struct swaybar_workspace;
-struct bar {
- struct config *config;
+struct swaybar_pointer {
+ struct wl_pointer *pointer;
+ struct wl_cursor_theme *cursor_theme;
+ struct wl_cursor_image *cursor_image;
+ struct wl_surface *cursor_surface;
+ struct swaybar_output *current;
+ int x, y;
+};
+
+struct swaybar_hotspot {
+ struct wl_list link;
+ int x, y, width, height;
+ void (*callback)(struct swaybar_output *output,
+ int x, int y, uint32_t button, void *data);
+ void (*destroy)(void *data);
+ void *data;
+};
+
+struct swaybar {
+ struct wl_display *display;
+ struct wl_compositor *compositor;
+ struct zwlr_layer_shell_v1 *layer_shell;
+ struct wl_shm *shm;
+ struct wl_seat *seat;
+
+ struct swaybar_config *config;
+ struct swaybar_output *focused_output;
+ struct swaybar_pointer pointer;
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;
+ uint32_t wl_name;
+
+ struct wl_list workspaces;
+ struct wl_list hotspots;
+
char *name;
- int idx;
+ size_t index;
bool focused;
+
+ uint32_t width, height;
+ int32_t scale;
+ 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 +73,10 @@ struct workspace {
bool urgent;
};
-/** Global bar state */
-extern struct bar swaybar;
-
-/** 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);
+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);
-/**
- * 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