mirror of
https://github.com/polybar/polybar.git
synced 2024-11-03 04:33:30 -05:00
39c73a8234
* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps * [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps * Fix minor error * Added WARN state for cpu module * Implement WARN state for CPU, Memory modules, working on fs module * Implement WARN state for fs module * Simplify WARN state implementation for cpu and memory * explicitly check percentage in get_by_percentage_with_borders * Fixed silly error * implement warn state on battery module, standardize the implementation on other modules * minor fixes * fix annoying error * use more intuitive param name * Fix percentage with borders bug * Make requested changes Hide the effect of warn states when unused * Backward Compat: use no format instead of fallback label * Reformat * Refactor * Reformat * Reformat: convert tabs to spaces * Reformat
32 lines
839 B
C++
32 lines
839 B
C++
#pragma once
|
|
|
|
#include "common.hpp"
|
|
#include "components/config.hpp"
|
|
#include "drawtypes/label.hpp"
|
|
#include "utils/mixins.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
namespace drawtypes {
|
|
class ramp : public non_copyable_mixin<ramp> {
|
|
public:
|
|
explicit ramp() = default;
|
|
explicit ramp(vector<label_t>&& icons) : m_icons(forward<decltype(icons)>(icons)) {}
|
|
|
|
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, float min, float max);
|
|
label_t get_by_percentage_with_borders(int percentage, int min, int max);
|
|
operator bool();
|
|
|
|
protected:
|
|
vector<label_t> m_icons;
|
|
};
|
|
|
|
using ramp_t = shared_ptr<ramp>;
|
|
|
|
ramp_t load_ramp(const config& conf, const string& section, string name, bool required = true);
|
|
}
|
|
|
|
POLYBAR_NS_END
|