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