Merge pull request #2923 from jones-josh/custom-tooltip-format
Add check for tooltip-format for custom modules
This commit is contained in:
commit
9191cae13b
|
@ -107,6 +107,11 @@ Addressed by *custom/<name>*
|
|||
default: true ++
|
||||
Option to disable tooltip on hover.
|
||||
|
||||
*tooltip-format*: ++
|
||||
typeof: string ++
|
||||
The tooltip format. If specified, overrides any tooltip output from the script in *exec*. ++
|
||||
Uses the same format replacements as *format*.
|
||||
|
||||
*escape*: ++
|
||||
typeof: bool ++
|
||||
default: false ++
|
||||
|
|
|
@ -170,6 +170,12 @@ auto waybar::modules::Custom::update() -> void {
|
|||
if (label_.get_tooltip_markup() != str) {
|
||||
label_.set_tooltip_markup(str);
|
||||
}
|
||||
} else if (config_["tooltip-format"].isString()) {
|
||||
auto tooltip = config_["tooltip-format"].asString();
|
||||
tooltip = fmt::format(fmt::runtime(tooltip), text_, fmt::arg("alt", alt_),
|
||||
fmt::arg("icon", getIcon(percentage_, alt_)),
|
||||
fmt::arg("percentage", percentage_));
|
||||
label_.set_tooltip_markup(tooltip);
|
||||
} else {
|
||||
if (label_.get_tooltip_markup() != tooltip_) {
|
||||
label_.set_tooltip_markup(tooltip_);
|
||||
|
|
Loading…
Reference in New Issue