#pragma once #include #include #include #include #include #include #include "bar.hpp" #include "AModule.hpp" #include "util/command.hpp" #include "util/json.hpp" #include "util/sleeper_thread.hpp" #include namespace waybar::modules { class CustomList : public AModule { public: CustomList(const std::string&, const waybar::Bar&, const std::string&,const Json::Value&); ~CustomList(); auto update() -> void; void refresh(int /*signal*/); private: void delayWorker(); void continuousWorker(); void parseOutputRaw(); void parseOutputJson(); void handleEvent(); bool handleScroll(GdkEventScroll* e); bool handleToggle(GdkEventButton* const& e); Gtk::Button &addButton(const Json::Value &node); void handleClick(std::string); std::unordered_map buttons_; std::vector results_; std::vector prev_; const std::string name_; const Bar& bar_; Gtk::Box box_; std::chrono::seconds interval_; std::string id_; std::vector class_; FILE* fp_; int pid_; util::command::res output_; util::JsonParser parser_; util::SleeperThread thread_; }; } // namespace waybar::modules