2016-01-24 02:34:20 +01:00
|
|
|
#ifndef _SWAYBAR_BAR_H
|
|
|
|
#define _SWAYBAR_BAR_H
|
2018-03-28 23:04:20 -04:00
|
|
|
#include <wayland-client.h>
|
|
|
|
#include "pool-buffer.h"
|
2018-09-17 16:04:09 +02:00
|
|
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
|
|
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
2016-01-23 20:55:01 +01:00
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
struct swaybar_config;
|
|
|
|
struct swaybar_output;
|
|
|
|
struct swaybar_workspace;
|
|
|
|
|
2018-03-30 21:38:28 -04: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-30 22:42:59 -04:00
|
|
|
int x, y;
|
|
|
|
};
|
|
|
|
|
2018-07-15 20:16:37 -04:00
|
|
|
enum x11_button {
|
|
|
|
NONE,
|
|
|
|
LEFT,
|
|
|
|
MIDDLE,
|
|
|
|
RIGHT,
|
|
|
|
SCROLL_UP,
|
|
|
|
SCROLL_DOWN,
|
|
|
|
SCROLL_LEFT,
|
|
|
|
SCROLL_RIGHT,
|
|
|
|
BACK,
|
|
|
|
FORWARD,
|
|
|
|
};
|
|
|
|
|
2018-07-19 21:15:01 +02:00
|
|
|
enum hotspot_event_handling {
|
|
|
|
HOTSPOT_IGNORE,
|
|
|
|
HOTSPOT_PROCESS,
|
|
|
|
};
|
|
|
|
|
2018-03-30 22:42:59 -04:00
|
|
|
struct swaybar_hotspot {
|
|
|
|
struct wl_list link;
|
|
|
|
int x, y, width, height;
|
2018-07-19 21:15:01 +02:00
|
|
|
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
|
2018-07-15 20:16:37 -04:00
|
|
|
int x, int y, enum x11_button button, void *data);
|
2018-03-30 22:42:59 -04:00
|
|
|
void (*destroy)(void *data);
|
|
|
|
void *data;
|
2018-03-30 21:38:28 -04:00
|
|
|
};
|
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
struct swaybar {
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
struct zwlr_layer_shell_v1 *layer_shell;
|
2018-09-17 16:04:09 +02:00
|
|
|
struct zxdg_output_manager_v1 *xdg_output_manager;
|
2018-03-28 23:04:20 -04:00
|
|
|
struct wl_shm *shm;
|
2018-03-30 21:38:28 -04:00
|
|
|
struct wl_seat *seat;
|
2016-01-23 20:55:01 +01:00
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
struct swaybar_config *config;
|
2018-03-30 21:38:28 -04:00
|
|
|
struct swaybar_pointer pointer;
|
2018-03-29 15:16:12 -04:00
|
|
|
struct status_line *status;
|
2018-03-28 23:04:20 -04:00
|
|
|
|
2018-03-28 23:56:02 -04:00
|
|
|
int ipc_event_socketfd;
|
|
|
|
int ipc_socketfd;
|
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
struct wl_list outputs;
|
2016-01-23 20:55:01 +01:00
|
|
|
};
|
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
struct swaybar_output {
|
|
|
|
struct wl_list link;
|
|
|
|
struct swaybar *bar;
|
|
|
|
struct wl_output *output;
|
2018-09-17 16:04:09 +02:00
|
|
|
struct zxdg_output_v1 *xdg_output;
|
2018-03-28 23:04:20 -04:00
|
|
|
struct wl_surface *surface;
|
|
|
|
struct zwlr_layer_surface_v1 *layer_surface;
|
2018-04-05 15:39:57 -04:00
|
|
|
uint32_t wl_name;
|
2018-03-28 23:04:20 -04:00
|
|
|
|
2018-03-29 00:21:05 -04:00
|
|
|
struct wl_list workspaces;
|
2018-03-30 22:42:59 -04:00
|
|
|
struct wl_list hotspots;
|
2018-03-29 00:21:05 -04:00
|
|
|
|
2016-01-24 00:23:09 +01:00
|
|
|
char *name;
|
2016-11-02 18:48:43 +01:00
|
|
|
bool focused;
|
2016-01-23 20:55:01 +01:00
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
uint32_t width, height;
|
2018-04-03 21:06:28 -04:00
|
|
|
int32_t scale;
|
2018-09-20 20:37:08 -07:00
|
|
|
enum wl_output_subpixel subpixel;
|
2018-03-28 23:04:20 -04:00
|
|
|
struct pool_buffer buffers[2];
|
|
|
|
struct pool_buffer *current_buffer;
|
2018-09-28 16:17:15 +01:00
|
|
|
bool dirty;
|
|
|
|
bool frame_scheduled;
|
2016-01-23 20:55:01 +01:00
|
|
|
};
|
|
|
|
|
2018-03-29 00:21:05 -04:00
|
|
|
struct swaybar_workspace {
|
|
|
|
struct wl_list link;
|
|
|
|
int num;
|
|
|
|
char *name;
|
|
|
|
bool focused;
|
|
|
|
bool visible;
|
|
|
|
bool urgent;
|
|
|
|
};
|
|
|
|
|
2018-09-24 18:42:25 +01:00
|
|
|
bool bar_setup(struct swaybar *bar, const char *socket_path, const char *bar_id);
|
2018-03-28 23:04:20 -04:00
|
|
|
void bar_run(struct swaybar *bar);
|
|
|
|
void bar_teardown(struct swaybar *bar);
|
2016-07-10 22:47:10 -05:00
|
|
|
|
2018-04-24 22:04:19 +01:00
|
|
|
void free_workspaces(struct wl_list *list);
|
|
|
|
|
2018-03-28 23:04:20 -04:00
|
|
|
#endif
|