#ifndef _MODULES_BATTERY_HPP_ #define _MODULES_BATTERY_HPP_ #include #include #include "modules/base.hpp" #include "drawtypes/animation.hpp" #include "drawtypes/icon.hpp" #include "drawtypes/label.hpp" #include "drawtypes/ramp.hpp" namespace modules { DefineModule(BatteryModule, InotifyModule) { public: static const int STATE_UNKNOWN = 1; static const int STATE_CHARGING = 2; static const int STATE_DISCHARGING = 3; static const int STATE_FULL = 4; protected: static constexpr auto FORMAT_CHARGING = "format:charging"; static constexpr auto FORMAT_DISCHARGING = "format:discharging"; static constexpr auto FORMAT_FULL = "format:full"; static constexpr auto TAG_ANIMATION_CHARGING = ""; static constexpr auto TAG_BAR_CAPACITY = ""; static constexpr auto TAG_RAMP_CAPACITY = ""; static constexpr auto TAG_LABEL_CHARGING = ""; static constexpr auto TAG_LABEL_DISCHARGING = ""; static constexpr auto TAG_LABEL_FULL = ""; std::unique_ptr animation_charging; std::unique_ptr ramp_capacity; std::unique_ptr bar_capacity; std::unique_ptr label_charging; std::unique_ptr label_charging_tokenized; std::unique_ptr label_discharging; std::unique_ptr label_discharging_tokenized; std::unique_ptr label_full; std::unique_ptr label_full_tokenized; std::string battery, adapter; concurrency::Atomic state; concurrency::Atomic percentage; int full_at; void subthread_runner(); public: BatteryModule(const std::string& name); void start(); bool on_event(InotifyEvent *event); std::string get_format(); bool build(Builder *builder, const std::string& tag); }; } #endif