1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-03 04:33:30 -05:00
polybar/include/modules/backlight.hpp

38 lines
893 B
C++
Raw Normal View History

#pragma once
2016-05-19 10:41:06 -04:00
#include "config.hpp"
#include "modules/base.hpp"
#include "drawtypes/bar.hpp"
#include "drawtypes/label.hpp"
namespace modules
{
DefineModule(BacklightModule, InotifyModule)
{
static constexpr auto TAG_LABEL = "<label>";
static constexpr auto TAG_BAR = "<bar>";
static constexpr auto TAG_RAMP = "<ramp>";
2016-05-19 10:41:06 -04: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;
concurrency::Atomic<int> percentage;
2016-05-19 10:41:06 -04:00
public:
explicit BacklightModule(const std::string& name);
2016-05-19 10:41:06 -04:00
bool on_event(InotifyEvent *event);
bool build(Builder *builder, const std::string& tag);
void idle() const
{
std::this_thread::sleep_for(25ms);
}
2016-05-19 10:41:06 -04:00
};
}