mirror of
https://github.com/polybar/polybar.git
synced 2024-11-11 13:50:56 -05:00
feat(temperature): Add hwmon sysfs support (#688)
This commit is contained in:
parent
8c1ba8358d
commit
ce05aa36a1
1 changed files with 4 additions and 1 deletions
|
@ -15,10 +15,13 @@ namespace modules {
|
||||||
temperature_module::temperature_module(const bar_settings& bar, string name_)
|
temperature_module::temperature_module(const bar_settings& bar, string name_)
|
||||||
: timer_module<temperature_module>(bar, move(name_)) {
|
: timer_module<temperature_module>(bar, move(name_)) {
|
||||||
m_zone = m_conf.get(name(), "thermal-zone", 0);
|
m_zone = m_conf.get(name(), "thermal-zone", 0);
|
||||||
|
m_path = m_conf.get(name(), "hwmon-path", ""s);
|
||||||
m_tempwarn = m_conf.get(name(), "warn-temperature", 80);
|
m_tempwarn = m_conf.get(name(), "warn-temperature", 80);
|
||||||
m_interval = m_conf.get<decltype(m_interval)>(name(), "interval", 1s);
|
m_interval = m_conf.get<decltype(m_interval)>(name(), "interval", 1s);
|
||||||
|
|
||||||
|
if (m_path.empty()) {
|
||||||
m_path = string_util::replace(PATH_TEMPERATURE_INFO, "%zone%", to_string(m_zone));
|
m_path = string_util::replace(PATH_TEMPERATURE_INFO, "%zone%", to_string(m_zone));
|
||||||
|
}
|
||||||
|
|
||||||
if (!file_util::exists(m_path)) {
|
if (!file_util::exists(m_path)) {
|
||||||
throw module_error("The file '" + m_path + "' does not exist");
|
throw module_error("The file '" + m_path + "' does not exist");
|
||||||
|
|
Loading…
Reference in a new issue