2018-10-30 13:39:30 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
2019-04-18 17:52:00 +02:00
|
|
|
#include "ALabel.hpp"
|
2018-10-30 13:39:30 +01:00
|
|
|
#include "bar.hpp"
|
|
|
|
#include "client.hpp"
|
|
|
|
#include "modules/sway/ipc/client.hpp"
|
2019-04-18 17:52:00 +02:00
|
|
|
#include "util/sleeper_thread.hpp"
|
2019-05-07 13:43:48 +02:00
|
|
|
#include "util/json.hpp"
|
2018-10-30 13:39:30 +01:00
|
|
|
|
|
|
|
namespace waybar::modules::sway {
|
|
|
|
|
|
|
|
class Mode : public ALabel {
|
2019-04-18 17:52:00 +02:00
|
|
|
public:
|
2019-05-07 13:21:18 +02:00
|
|
|
Mode(const std::string&, const Json::Value&);
|
2019-04-18 17:52:00 +02:00
|
|
|
~Mode() = default;
|
|
|
|
auto update() -> void;
|
|
|
|
|
|
|
|
private:
|
2019-04-24 12:37:24 +02:00
|
|
|
void onEvent(const struct Ipc::ipc_response&);
|
2019-04-18 17:52:00 +02:00
|
|
|
void worker();
|
|
|
|
|
|
|
|
waybar::util::SleeperThread thread_;
|
|
|
|
Ipc ipc_;
|
|
|
|
std::string mode_;
|
2019-05-07 13:43:48 +02:00
|
|
|
util::JsonParser parser_;
|
2018-10-30 13:39:30 +01:00
|
|
|
};
|
|
|
|
|
2019-04-18 17:52:00 +02:00
|
|
|
} // namespace waybar::modules::sway
|