waybar/include/modules/custom.hpp

36 lines
736 B
C++
Raw Normal View History

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