Waybar/include/modules/custom.hpp

37 lines
766 B
C++
Raw Normal View History

#pragma once
#include <fmt/format.h>
2018-08-18 15:27:40 +00:00
#include <iostream>
2018-12-26 10:13:36 +00:00
#include "util/sleeper_thread.hpp"
#include "util/command.hpp"
#include "util/json.hpp"
#include "ALabel.hpp"
namespace waybar::modules {
class Custom : public ALabel {
2018-08-16 12:29:41 +00:00
public:
2018-12-18 16:30:54 +00:00
Custom(const std::string&, const Json::Value&);
2018-12-08 11:58:47 +00:00
~Custom();
2018-08-16 12:29:41 +00:00
auto update() -> void;
private:
2018-09-18 21:15:37 +00:00
void delayWorker();
void continuousWorker();
void parseOutputRaw();
void parseOutputJson();
2018-08-20 12:50:45 +00:00
const std::string name_;
std::string text_;
std::string alt_;
std::string tooltip_;
std::string class_;
std::string prevclass_;
int percentage_;
2018-08-16 12:29:41 +00:00
waybar::util::SleeperThread thread_;
waybar::util::command::res output_;
waybar::util::JsonParser parser_;
2018-12-08 11:58:47 +00:00
FILE* fp_;
2018-08-16 12:29:41 +00:00
};
}