2022-01-17 00:55:13 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <gtkmm/image.h>
|
|
|
|
|
|
|
|
#include <csignal>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "ALabel.hpp"
|
2023-01-24 20:34:02 +01:00
|
|
|
#include "gtkmm/box.h"
|
2022-01-17 00:55:13 +01:00
|
|
|
#include "util/command.hpp"
|
|
|
|
#include "util/json.hpp"
|
|
|
|
#include "util/sleeper_thread.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules {
|
|
|
|
|
|
|
|
class Image : public AModule {
|
|
|
|
public:
|
2023-01-24 20:34:02 +01:00
|
|
|
Image(const std::string&, const Json::Value&);
|
2023-03-02 14:57:07 +01:00
|
|
|
virtual ~Image() = default;
|
|
|
|
auto update() -> void override;
|
|
|
|
void refresh(int /*signal*/) override;
|
2022-01-17 00:55:13 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void delayWorker();
|
|
|
|
void handleEvent();
|
2023-04-21 10:38:21 +02:00
|
|
|
void parseOutputRaw();
|
2022-01-17 00:55:13 +01:00
|
|
|
|
2023-01-24 20:34:02 +01:00
|
|
|
Gtk::Box box_;
|
2023-01-04 16:26:50 +01:00
|
|
|
Gtk::Image image_;
|
2022-01-17 00:55:13 +01:00
|
|
|
std::string path_;
|
2023-04-21 10:38:21 +02:00
|
|
|
std::string tooltip_;
|
2023-01-04 16:26:50 +01:00
|
|
|
int size_;
|
|
|
|
int interval_;
|
2023-04-21 10:38:21 +02:00
|
|
|
util::command::res output_;
|
2022-01-17 00:55:13 +01:00
|
|
|
|
|
|
|
util::SleeperThread thread_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace waybar::modules
|