polybar-dwm/include/modules/backlight.hpp

47 lines
945 B
C++
Raw Normal View History

#pragma once
2016-05-19 14:41:06 +00:00
#include "components/config.hpp"
2016-10-25 05:10:03 +00:00
#include "config.hpp"
2016-05-19 14:41:06 +00:00
#include "drawtypes/label.hpp"
2016-06-15 03:32:35 +00:00
#include "drawtypes/progressbar.hpp"
#include "drawtypes/ramp.hpp"
#include "modules/meta.hpp"
2016-05-19 14:41:06 +00:00
2016-06-15 03:32:35 +00:00
LEMONBUDDY_NS
namespace modules {
struct brightness_handle {
2016-11-02 19:22:45 +00:00
void filepath(string path);
float read() const;
private:
string m_path;
};
2016-06-15 03:32:35 +00:00
class backlight_module : public inotify_module<backlight_module> {
public:
using inotify_module::inotify_module;
2016-11-02 19:22:45 +00:00
void setup();
void idle();
bool on_event(inotify_event* event);
bool build(builder* builder, string tag) const;
2016-06-15 03:32:35 +00: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;
brightness_handle m_val;
brightness_handle m_max;
2016-06-15 03:32:35 +00:00
int m_percentage = 0;
2016-05-19 14:41:06 +00:00
};
}
2016-06-15 03:32:35 +00:00
LEMONBUDDY_NS_END