Waybar/include/modules/sway/mode.hpp

30 lines
693 B
C++
Raw Normal View History

2018-10-30 12:39:30 +00:00
#pragma once
#include <fmt/format.h>
2019-04-18 15:52:00 +00:00
#include "ALabel.hpp"
2018-10-30 12:39:30 +00:00
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
2019-04-18 15:52:00 +00:00
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
2018-10-30 12:39:30 +00:00
namespace waybar::modules::sway {
class Mode : public ALabel {
2019-04-18 15:52:00 +00:00
public:
Mode(const std::string&, const waybar::Bar&, const Json::Value&);
~Mode() = default;
auto update() -> void;
private:
2019-04-19 09:09:06 +00:00
void onEvent(const struct Ipc::ipc_response);
2019-04-18 15:52:00 +00:00
void worker();
const Bar& bar_;
waybar::util::SleeperThread thread_;
util::JsonParser parser_;
Ipc ipc_;
std::string mode_;
2018-10-30 12:39:30 +00:00
};
2019-04-18 15:52:00 +00:00
} // namespace waybar::modules::sway