2018-08-29 20:36:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include "IModule.hpp"
|
2019-04-17 14:19:04 +02:00
|
|
|
#include "bar.hpp"
|
2018-11-22 15:47:23 +01:00
|
|
|
#include "modules/sni/host.hpp"
|
2019-04-17 14:19:04 +02:00
|
|
|
#include "modules/sni/watcher.hpp"
|
|
|
|
#include "util/json.hpp"
|
2018-08-29 20:36:39 +02:00
|
|
|
|
|
|
|
namespace waybar::modules::SNI {
|
|
|
|
|
|
|
|
class Tray : public IModule {
|
2019-04-17 14:19:04 +02:00
|
|
|
public:
|
|
|
|
Tray(const std::string&, const Bar&, const Json::Value&);
|
|
|
|
~Tray() = default;
|
|
|
|
auto update() -> void;
|
2019-04-18 17:52:00 +02:00
|
|
|
operator Gtk::Widget&();
|
2019-04-17 14:19:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void onAdd(std::unique_ptr<Item>& item);
|
|
|
|
void onRemove(std::unique_ptr<Item>& item);
|
2018-11-22 15:47:23 +01:00
|
|
|
|
2019-04-17 14:19:04 +02:00
|
|
|
static inline std::size_t nb_hosts_ = 0;
|
2019-04-18 17:52:00 +02:00
|
|
|
const Json::Value& config_;
|
|
|
|
Gtk::Box box_;
|
|
|
|
SNI::Watcher watcher_;
|
|
|
|
SNI::Host host_;
|
2018-08-29 20:36:39 +02:00
|
|
|
};
|
|
|
|
|
2019-04-17 14:19:04 +02:00
|
|
|
} // namespace waybar::modules::SNI
|