mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Add "tooltip-format" to temperature module
This commit is contained in:
parent
05b12602d4
commit
3b576ae12d
@ -50,6 +50,11 @@ Addressed by *temperature*
|
|||||||
typeof: array ++
|
typeof: array ++
|
||||||
Based on the current temperature (Celsius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*.
|
Based on the current temperature (Celsius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*.
|
||||||
|
|
||||||
|
*tooltip-format*: ++
|
||||||
|
typeof: string ++
|
||||||
|
default: {temperatureC}°C ++
|
||||||
|
The format for the tooltip
|
||||||
|
|
||||||
*rotate*: ++
|
*rotate*: ++
|
||||||
typeof: integer ++
|
typeof: integer ++
|
||||||
Positive value to rotate the text label.
|
Positive value to rotate the text label.
|
||||||
|
@ -40,6 +40,16 @@ auto waybar::modules::Temperature::update() -> void {
|
|||||||
fmt::arg("temperatureF", temperature_f),
|
fmt::arg("temperatureF", temperature_f),
|
||||||
fmt::arg("temperatureK", temperature_k),
|
fmt::arg("temperatureK", temperature_k),
|
||||||
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
||||||
|
if (tooltipEnabled()) {
|
||||||
|
std::string tooltip_format = "{temperatureC}°C";
|
||||||
|
if (config_["tooltip-format"].isString()) {
|
||||||
|
tooltip_format = config_["tooltip-format"].asString();
|
||||||
|
}
|
||||||
|
label_.set_tooltip_text(fmt::format(tooltip_format,
|
||||||
|
fmt::arg("temperatureC", temperature_c),
|
||||||
|
fmt::arg("temperatureF", temperature_f),
|
||||||
|
fmt::arg("temperatureK", temperature_k)));
|
||||||
|
}
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user