2018-08-08 21:54:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-08 20:05:44 +00:00
|
|
|
#include <glibmm/refptr.h>
|
|
|
|
#include <gtkmm/cssprovider.h>
|
2019-04-18 15:43:16 +00:00
|
|
|
#include <gtkmm/main.h>
|
2019-01-08 20:05:44 +00:00
|
|
|
#include <gtkmm/window.h>
|
2019-04-18 15:43:16 +00:00
|
|
|
#include <json/json.h>
|
|
|
|
#include "IModule.hpp"
|
|
|
|
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
2018-08-08 21:54:58 +00:00
|
|
|
#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-19 11:39:57 +00:00
|
|
|
class Factory;
|
2019-04-18 15:43:16 +00:00
|
|
|
struct waybar_output {
|
|
|
|
struct wl_output *output;
|
|
|
|
std::string name;
|
|
|
|
uint32_t wl_name;
|
|
|
|
struct zxdg_output_v1 *xdg_output;
|
|
|
|
Json::Value config;
|
|
|
|
};
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2018-08-16 12:29:41 +00:00
|
|
|
class Bar {
|
2019-04-18 15:43:16 +00:00
|
|
|
public:
|
|
|
|
Bar(struct waybar_output* w_output);
|
|
|
|
Bar(const Bar &) = delete;
|
|
|
|
~Bar() = default;
|
|
|
|
|
|
|
|
auto toggle() -> void;
|
|
|
|
void handleSignal(int);
|
|
|
|
|
|
|
|
struct waybar_output* output;
|
|
|
|
Gtk::Window window;
|
|
|
|
struct wl_surface *surface;
|
|
|
|
struct zwlr_layer_surface_v1 *layer_surface;
|
|
|
|
bool visible = true;
|
|
|
|
bool vertical = false;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void layerSurfaceHandleConfigure(void *, struct zwlr_layer_surface_v1 *, uint32_t,
|
|
|
|
uint32_t, uint32_t);
|
|
|
|
static void layerSurfaceHandleClosed(void *, struct zwlr_layer_surface_v1 *);
|
|
|
|
|
|
|
|
void destroyOutput();
|
|
|
|
void onWindowRealize();
|
|
|
|
auto setupWidgets() -> void;
|
|
|
|
void getModules(const Factory &, const std::string &);
|
|
|
|
void setupAltFormatKeyForModule(const std::string &module_name);
|
|
|
|
void setupAltFormatKeyForModuleList(const char *module_list_name);
|
|
|
|
|
|
|
|
uint32_t width_ = 0;
|
|
|
|
uint32_t height_ = 30;
|
|
|
|
Gtk::Box left_;
|
|
|
|
Gtk::Box center_;
|
|
|
|
Gtk::Box right_;
|
|
|
|
Gtk::Box box_;
|
|
|
|
std::vector<std::unique_ptr<waybar::IModule>> modules_left_;
|
|
|
|
std::vector<std::unique_ptr<waybar::IModule>> modules_center_;
|
|
|
|
std::vector<std::unique_ptr<waybar::IModule>> modules_right_;
|
2018-08-16 12:29:41 +00:00
|
|
|
};
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2019-04-18 15:43:16 +00:00
|
|
|
} // namespace waybar
|