2016-05-30 23:58:58 -04:00
|
|
|
#pragma once
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-10-19 08:46:43 -04:00
|
|
|
#include "components/config.hpp"
|
2016-10-25 01:10:03 -04:00
|
|
|
#include "config.hpp"
|
2016-11-20 17:04:31 -05:00
|
|
|
#include "modules/meta/inotify_module.hpp"
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
namespace modules {
|
2016-10-19 08:46:43 -04:00
|
|
|
struct brightness_handle {
|
2016-11-25 07:55:15 -05:00
|
|
|
void filepath(const string& path);
|
2016-11-02 15:22:45 -04:00
|
|
|
float read() const;
|
2016-10-19 08:46:43 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
string m_path;
|
|
|
|
};
|
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
class backlight_module : public inotify_module<backlight_module> {
|
|
|
|
public:
|
|
|
|
using inotify_module::inotify_module;
|
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
void setup();
|
|
|
|
void idle();
|
|
|
|
bool on_event(inotify_event* event);
|
2016-11-25 07:55:15 -05:00
|
|
|
bool build(builder* builder, const string& tag) const;
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr auto TAG_LABEL = "<label>";
|
|
|
|
static constexpr auto TAG_BAR = "<bar>";
|
|
|
|
static constexpr auto TAG_RAMP = "<ramp>";
|
|
|
|
|
|
|
|
ramp_t m_ramp;
|
|
|
|
label_t m_label;
|
|
|
|
progressbar_t m_progressbar;
|
|
|
|
|
2016-10-19 08:46:43 -04:00
|
|
|
brightness_handle m_val;
|
|
|
|
brightness_handle m_max;
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2016-10-19 08:46:43 -04:00
|
|
|
int m_percentage = 0;
|
2016-05-19 10:41:06 -04:00
|
|
|
};
|
|
|
|
}
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|