Waybar/include/modules/image.hpp

41 lines
751 B
C++
Raw Normal View History

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