2016-01-24 01:34:20 +00:00
|
|
|
#ifndef _SWAYBAR_BAR_H
|
|
|
|
#define _SWAYBAR_BAR_H
|
2018-03-29 03:04:20 +00:00
|
|
|
#include <wayland-client.h>
|
|
|
|
#include "pool-buffer.h"
|
2016-01-23 19:55:01 +00:00
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
struct swaybar_config;
|
|
|
|
struct swaybar_output;
|
|
|
|
struct swaybar_workspace;
|
|
|
|
|
2018-03-31 01:38:28 +00:00
|
|
|
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;
|
2018-03-31 02:42:59 +00:00
|
|
|
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;
|
2018-03-31 01:38:28 +00:00
|
|
|
};
|
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
struct swaybar {
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
struct zwlr_layer_shell_v1 *layer_shell;
|
|
|
|
struct wl_shm *shm;
|
2018-03-31 01:38:28 +00:00
|
|
|
struct wl_seat *seat;
|
2016-01-23 19:55:01 +00:00
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
struct swaybar_config *config;
|
|
|
|
struct swaybar_output *focused_output;
|
2018-03-31 01:38:28 +00:00
|
|
|
struct swaybar_pointer pointer;
|
2018-03-29 19:16:12 +00:00
|
|
|
struct status_line *status;
|
2018-03-29 03:04:20 +00:00
|
|
|
|
2018-03-29 03:56:02 +00:00
|
|
|
int ipc_event_socketfd;
|
|
|
|
int ipc_socketfd;
|
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
struct wl_list outputs;
|
2016-01-23 19:55:01 +00:00
|
|
|
};
|
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
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;
|
|
|
|
|
2018-03-29 04:21:05 +00:00
|
|
|
struct wl_list workspaces;
|
2018-03-31 02:42:59 +00:00
|
|
|
struct wl_list hotspots;
|
2018-03-29 04:21:05 +00:00
|
|
|
|
2016-01-23 23:23:09 +00:00
|
|
|
char *name;
|
2018-03-29 04:07:35 +00:00
|
|
|
size_t index;
|
2016-11-02 17:48:43 +00:00
|
|
|
bool focused;
|
2016-01-23 19:55:01 +00:00
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
uint32_t width, height;
|
|
|
|
struct pool_buffer buffers[2];
|
|
|
|
struct pool_buffer *current_buffer;
|
2016-01-23 19:55:01 +00:00
|
|
|
};
|
|
|
|
|
2018-03-29 04:21:05 +00:00
|
|
|
struct swaybar_workspace {
|
|
|
|
struct wl_list link;
|
|
|
|
int num;
|
|
|
|
char *name;
|
|
|
|
bool focused;
|
|
|
|
bool visible;
|
|
|
|
bool urgent;
|
|
|
|
};
|
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
void bar_setup(struct swaybar *bar,
|
2018-03-29 04:21:05 +00:00
|
|
|
const char *socket_path,
|
|
|
|
const char *bar_id);
|
2018-03-29 03:04:20 +00:00
|
|
|
void bar_run(struct swaybar *bar);
|
|
|
|
void bar_teardown(struct swaybar *bar);
|
2016-07-11 03:47:10 +00:00
|
|
|
|
2018-03-29 03:04:20 +00:00
|
|
|
#endif
|