Files
Waybar/include/modules/image.hpp
copilot-swe-agent[bot] 4cadae83b3 Improve comments for cached signal values
Clarify that -1 indicates signal-based refresh is disabled

Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 08:54:14 +00:00

42 lines
867 B
C++

#pragma once
#include <fmt/format.h>
#include <gtkmm/image.h>
#include <csignal>
#include <string>
#include "ALabel.hpp"
#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:
Image(const std::string&, const Json::Value&);
virtual ~Image() = default;
auto update() -> void override;
void refresh(int /*signal*/) override;
private:
void delayWorker();
void handleEvent();
void parseOutputRaw();
Gtk::Box box_;
Gtk::Image image_;
std::string path_;
std::string tooltip_;
int size_;
std::chrono::milliseconds interval_;
util::command::res output_;
int signal_; // Cached signal value (-1 = disabled) to avoid JSON access in signal handler
util::SleeperThread thread_;
};
} // namespace waybar::modules