1 #pragma once
2 
3 #include <istream>
4 
5 #include "modules/meta/timer_module.hpp"
6 #include "settings.hpp"
7 
8 POLYBAR_NS
9 
10 namespace modules {
11   enum class temp_state { NORMAL = 0, WARN };
12 
13   class temperature_module : public timer_module<temperature_module> {
14    public:
15     explicit temperature_module(const bar_settings&, string);
16 
17     bool update();
18     string get_format() const;
19     bool build(builder* builder, const string& tag) const;
20 
21     static constexpr auto TYPE = "internal/temperature";
22 
23    private:
24     static constexpr auto TAG_LABEL = "<label>";
25     static constexpr auto TAG_LABEL_WARN = "<label-warn>";
26     static constexpr auto TAG_RAMP = "<ramp>";
27     static constexpr auto FORMAT_WARN = "format-warn";
28 
29     map<temp_state, label_t> m_label;
30     ramp_t m_ramp;
31 
32     string m_path;
33     int m_zone = 0;
34     // Base temperature used for where to start the ramp
35     int m_tempbase = 0;
36     int m_tempwarn = 0;
37     int m_temp = 0;
38     // Percentage used in the ramp
39     int m_perc = 0;
40 
41     // Whether or not to show units with the %temperature-X% tokens
42     bool m_units{true};
43   };
44 }  // namespace modules
45 
46 POLYBAR_NS_END
47