Gtk4: Migration temperature
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>pull/2956/head
parent
0b56c55d8d
commit
bf9325d724
|
@ -1,9 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ALabel.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ src_files = files(
|
|||
'src/group.cpp',
|
||||
'src/ASlider.cpp',
|
||||
'src/modules/load.cpp',
|
||||
'src/modules/disk.cpp'
|
||||
'src/modules/disk.cpp',
|
||||
'src/modules/temperature.cpp'
|
||||
)
|
||||
|
||||
man_files = files(
|
||||
|
|
|
@ -308,10 +308,10 @@ gtk4 todo
|
|||
if (ref == "systemd-failed-units") {
|
||||
return new waybar::modules::SystemdFailedUnits(id, config_[name]);
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
if (ref == "temperature") {
|
||||
return new waybar::modules::Temperature(id, config_[name]);
|
||||
}
|
||||
}/*
|
||||
if (ref.compare(0, 7, "custom/") == 0 && ref.size() > 7) {
|
||||
return new waybar::modules::Custom(ref.substr(7), id, config_[name], bar_.output->name);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "modules/temperature.hpp"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fstream>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
|
@ -52,20 +55,20 @@ auto waybar::modules::Temperature::update() -> void {
|
|||
auto format = format_;
|
||||
if (critical) {
|
||||
format = config_["format-critical"].isString() ? config_["format-critical"].asString() : format;
|
||||
label_.get_style_context()->add_class("critical");
|
||||
Gtk::Label::get_style_context()->add_class("critical");
|
||||
} else {
|
||||
label_.get_style_context()->remove_class("critical");
|
||||
Gtk::Label::get_style_context()->remove_class("critical");
|
||||
}
|
||||
|
||||
if (format.empty()) {
|
||||
event_box_.hide();
|
||||
Gtk::Label::hide();
|
||||
return;
|
||||
} else {
|
||||
event_box_.show();
|
||||
Gtk::Label::show();
|
||||
}
|
||||
|
||||
auto max_temp = config_["critical-threshold"].isInt() ? config_["critical-threshold"].asInt() : 0;
|
||||
label_.set_markup(fmt::format(fmt::runtime(format), fmt::arg("temperatureC", temperature_c),
|
||||
Gtk::Label::set_markup(fmt::format(fmt::runtime(format), fmt::arg("temperatureC", temperature_c),
|
||||
fmt::arg("temperatureF", temperature_f),
|
||||
fmt::arg("temperatureK", temperature_k),
|
||||
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
||||
|
@ -74,7 +77,7 @@ auto waybar::modules::Temperature::update() -> void {
|
|||
if (config_["tooltip-format"].isString()) {
|
||||
tooltip_format = config_["tooltip-format"].asString();
|
||||
}
|
||||
label_.set_tooltip_text(fmt::format(
|
||||
Gtk::Label::set_tooltip_text(fmt::format(
|
||||
fmt::runtime(tooltip_format), fmt::arg("temperatureC", temperature_c),
|
||||
fmt::arg("temperatureF", temperature_f), fmt::arg("temperatureK", temperature_k)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue