2018-08-08 21:54:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-08-09 10:05:48 +00:00
|
|
|
#include <json/json.h>
|
2018-08-08 21:54:58 +00:00
|
|
|
#include <gtkmm.h>
|
|
|
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
2018-08-10 22:32:59 +00:00
|
|
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
2018-08-08 21:54:58 +00:00
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
2018-08-16 12:29:41 +00:00
|
|
|
class Client;
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2018-08-16 12:29:41 +00:00
|
|
|
class Bar {
|
|
|
|
public:
|
|
|
|
Bar(Client&, std::unique_ptr<struct wl_output *>&&);
|
2018-08-08 21:54:58 +00:00
|
|
|
Bar(const Bar&) = delete;
|
2018-08-16 12:29:41 +00:00
|
|
|
|
|
|
|
auto setWidth(uint32_t) -> void;
|
|
|
|
auto toggle() -> void;
|
|
|
|
|
2018-08-08 21:54:58 +00:00
|
|
|
Client& client;
|
|
|
|
Gtk::Window window;
|
|
|
|
struct wl_surface *surface;
|
2018-08-16 12:29:41 +00:00
|
|
|
struct zwlr_layer_surface_v1 *layer_surface;
|
2018-08-08 21:54:58 +00:00
|
|
|
std::unique_ptr<struct wl_output *> output;
|
2018-08-10 22:32:59 +00:00
|
|
|
std::string outputName;
|
2018-08-16 12:29:41 +00:00
|
|
|
bool visible = true;
|
2018-08-08 21:54:58 +00:00
|
|
|
private:
|
2018-08-16 12:29:41 +00:00
|
|
|
static void handleLogicalPosition(void *, struct zxdg_output_v1 *, int32_t,
|
|
|
|
int32_t);
|
|
|
|
static void handleLogicalSize(void *, struct zxdg_output_v1 *, int32_t,
|
|
|
|
int32_t);
|
|
|
|
static void handleDone(void *, struct zxdg_output_v1 *);
|
|
|
|
static void handleName(void *, struct zxdg_output_v1 *, const char *);
|
|
|
|
static void handleDescription(void *, struct zxdg_output_v1 *,
|
|
|
|
const char *);
|
|
|
|
static void layerSurfaceHandleConfigure(void *,
|
|
|
|
struct zwlr_layer_surface_v1 *, uint32_t, uint32_t, uint32_t);
|
|
|
|
static void layerSurfaceHandleClosed(void *,
|
|
|
|
struct zwlr_layer_surface_v1 *);
|
|
|
|
|
|
|
|
auto setupConfig() -> void;
|
|
|
|
auto setupWidgets() -> void;
|
|
|
|
auto setupCss() -> void;
|
|
|
|
|
|
|
|
uint32_t width_ = 0;
|
|
|
|
uint32_t height_ = 30;
|
|
|
|
Json::Value config_;
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> style_context_;
|
|
|
|
Glib::RefPtr<Gtk::CssProvider> css_provider_;
|
|
|
|
struct zxdg_output_v1 *xdg_output_;
|
|
|
|
};
|
2018-08-08 21:54:58 +00:00
|
|
|
|
|
|
|
}
|