2016-05-31 03:58:58 +00:00
|
|
|
#pragma once
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
#include "config.hpp"
|
|
|
|
#include "modules/base.hpp"
|
|
|
|
#include "drawtypes/bar.hpp"
|
|
|
|
#include "drawtypes/label.hpp"
|
|
|
|
|
|
|
|
namespace modules
|
|
|
|
{
|
|
|
|
DefineModule(BacklightModule, InotifyModule)
|
|
|
|
{
|
2016-05-31 03:58:58 +00:00
|
|
|
static constexpr auto TAG_LABEL = "<label>";
|
|
|
|
static constexpr auto TAG_BAR = "<bar>";
|
|
|
|
static constexpr auto TAG_RAMP = "<ramp>";
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
std::unique_ptr<drawtypes::Bar> bar;
|
|
|
|
std::unique_ptr<drawtypes::Ramp> ramp;
|
|
|
|
std::unique_ptr<drawtypes::Label> label;
|
|
|
|
std::unique_ptr<drawtypes::Label> label_tokenized;
|
|
|
|
|
|
|
|
std::string path_val, path_max;
|
|
|
|
float val = 0, max = 0;
|
|
|
|
|
2016-05-31 03:58:58 +00:00
|
|
|
concurrency::Atomic<int> percentage;
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
public:
|
2016-06-21 01:59:43 +00:00
|
|
|
explicit BacklightModule(std::string name);
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
bool on_event(InotifyEvent *event);
|
2016-06-21 01:59:43 +00:00
|
|
|
bool build(Builder *builder, std::string tag);
|
2016-05-31 03:58:58 +00:00
|
|
|
|
2016-06-29 09:06:33 +00:00
|
|
|
void idle() const {
|
2016-05-31 03:58:58 +00:00
|
|
|
std::this_thread::sleep_for(25ms);
|
|
|
|
}
|
2016-05-19 14:41:06 +00:00
|
|
|
};
|
|
|
|
}
|