diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 1851bde2..e8c3aafa 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -55,7 +55,7 @@ class bar : public xpp::event::sink { + > { public: using make_type = unique_ptr; static make_type make(bool only_initialize_values = false); diff --git a/include/drawtypes/ramp.hpp b/include/drawtypes/ramp.hpp index fb94c190..f2ba0974 100644 --- a/include/drawtypes/ramp.hpp +++ b/include/drawtypes/ramp.hpp @@ -16,7 +16,8 @@ namespace drawtypes { void add(label_t&& icon); label_t get(size_t index); label_t get_by_percentage(float percentage); - label_t get_by_percentage_with_borders(float percentage); + label_t get_by_percentage_with_borders(float percentage, float min, float max); + label_t get_by_percentage_with_borders(int percentage, int min, int max); operator bool(); protected: diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index 07fba087..583a6de1 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -12,6 +12,7 @@ namespace modules { NONE = 0, CHARGING, DISCHARGING, + LOW, FULL, }; @@ -68,14 +69,17 @@ namespace modules { static constexpr const char* FORMAT_CHARGING{"format-charging"}; static constexpr const char* FORMAT_DISCHARGING{"format-discharging"}; static constexpr const char* FORMAT_FULL{"format-full"}; + static constexpr const char* FORMAT_LOW{"format-low"}; static constexpr const char* TAG_ANIMATION_CHARGING{""}; static constexpr const char* TAG_ANIMATION_DISCHARGING{""}; + static constexpr const char* TAG_ANIMATION_LOW{""}; static constexpr const char* TAG_BAR_CAPACITY{""}; static constexpr const char* TAG_RAMP_CAPACITY{""}; static constexpr const char* TAG_LABEL_CHARGING{""}; static constexpr const char* TAG_LABEL_DISCHARGING{""}; static constexpr const char* TAG_LABEL_FULL{""}; + static constexpr const char* TAG_LABEL_LOW{""}; static const size_t SKIP_N_UNCHANGED{3_z}; @@ -87,8 +91,10 @@ namespace modules { label_t m_label_charging; label_t m_label_discharging; label_t m_label_full; + label_t m_label_low; animation_t m_animation_charging; animation_t m_animation_discharging; + animation_t m_animation_low; progressbar_t m_bar_capacity; ramp_t m_ramp_capacity; @@ -102,6 +108,7 @@ namespace modules { int m_percentage{0}; int m_fullat{100}; + int m_lowat{10}; string m_timeformat; size_t m_unchanged{SKIP_N_UNCHANGED}; chrono::duration m_interval{}; diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp index 003c9fb2..26d7e165 100644 --- a/include/modules/cpu.hpp +++ b/include/modules/cpu.hpp @@ -6,6 +6,7 @@ POLYBAR_NS namespace modules { + enum class cpu_state { NORMAL = 0, WARN }; struct cpu_time { unsigned long long user; unsigned long long nice; @@ -22,6 +23,7 @@ namespace modules { explicit cpu_module(const bar_settings&, string); bool update(); + string get_format() const; bool build(builder* builder, const string& tag) const; static constexpr auto TYPE = "internal/cpu"; @@ -32,19 +34,24 @@ namespace modules { private: static constexpr auto TAG_LABEL = "