2016-11-10 01:52:11 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <istream>
|
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
#include "modules/meta/timer_module.hpp"
|
2020-05-15 13:59:08 -04:00
|
|
|
#include "settings.hpp"
|
2016-11-10 01:52:11 -05:00
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-11-10 01:52:11 -05:00
|
|
|
|
|
|
|
namespace modules {
|
|
|
|
enum class temp_state { NORMAL = 0, WARN };
|
|
|
|
|
|
|
|
class temperature_module : public timer_module<temperature_module> {
|
|
|
|
public:
|
2016-12-21 02:00:09 -05:00
|
|
|
explicit temperature_module(const bar_settings&, string);
|
2016-11-10 01:52:11 -05:00
|
|
|
|
|
|
|
bool update();
|
|
|
|
string get_format() const;
|
2016-11-25 07:55:15 -05:00
|
|
|
bool build(builder* builder, const string& tag) const;
|
2016-11-10 01:52:11 -05:00
|
|
|
|
2020-05-15 13:59:08 -04:00
|
|
|
static constexpr auto TYPE = "internal/temperature";
|
|
|
|
|
2016-11-10 01:52:11 -05:00
|
|
|
private:
|
|
|
|
static constexpr auto TAG_LABEL = "<label>";
|
|
|
|
static constexpr auto TAG_LABEL_WARN = "<label-warn>";
|
2016-11-11 13:35:08 -05:00
|
|
|
static constexpr auto TAG_RAMP = "<ramp>";
|
2016-11-10 01:52:11 -05:00
|
|
|
static constexpr auto FORMAT_WARN = "format-warn";
|
|
|
|
|
|
|
|
map<temp_state, label_t> m_label;
|
2016-11-11 13:35:08 -05:00
|
|
|
ramp_t m_ramp;
|
2016-11-10 01:52:11 -05:00
|
|
|
|
|
|
|
string m_path;
|
2016-11-11 13:35:08 -05:00
|
|
|
int m_zone = 0;
|
2019-04-07 12:36:09 -04:00
|
|
|
// Base temperature used for where to start the ramp
|
|
|
|
int m_tempbase = 0;
|
2016-11-11 13:35:08 -05:00
|
|
|
int m_tempwarn = 0;
|
2016-11-10 01:52:11 -05:00
|
|
|
int m_temp = 0;
|
2018-02-15 04:33:20 -05:00
|
|
|
|
|
|
|
// Whether or not to show units with the %temperature-X% tokens
|
|
|
|
bool m_units{true};
|
2016-11-10 01:52:11 -05:00
|
|
|
};
|
2020-05-15 13:59:08 -04:00
|
|
|
} // namespace modules
|
2016-11-10 01:52:11 -05:00
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|