Skip to content

Commit c32d5e3

Browse files
authored
Merge pull request Alexays#3898 from Duckulus/master
[hyprland/window] enable tooltip for hyprland window module
2 parents 834868e + ba12ca7 commit c32d5e3

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/modules/hyprland/window.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,35 @@ auto Window::update() -> void {
5656

5757
windowData_.title = windowName;
5858

59+
std::string label_text;
5960
if (!format_.empty()) {
6061
label_.show();
61-
label_.set_markup(waybar::util::rewriteString(
62+
label_text = waybar::util::rewriteString(
6263
fmt::format(fmt::runtime(format_), fmt::arg("title", windowName),
6364
fmt::arg("initialTitle", windowData_.initial_title),
6465
fmt::arg("class", windowData_.class_name),
6566
fmt::arg("initialClass", windowData_.initial_class_name)),
66-
config_["rewrite"]));
67+
config_["rewrite"]);
68+
label_.set_markup(label_text);
6769
} else {
6870
label_.hide();
6971
}
7072

73+
if (tooltipEnabled()) {
74+
std::string tooltip_format;
75+
if (config_["tooltip-format"].isString()) {
76+
tooltip_format = config_["tooltip-format"].asString();
77+
}
78+
if (!tooltip_format.empty()) {
79+
label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format), fmt::arg("title", windowName),
80+
fmt::arg("initialTitle", windowData_.initial_title),
81+
fmt::arg("class", windowData_.class_name),
82+
fmt::arg("initialClass", windowData_.initial_class_name)));
83+
} else if (!label_text.empty()){
84+
label_.set_tooltip_text(label_text);
85+
}
86+
}
87+
7188
if (focused_) {
7289
image_.show();
7390
} else {

0 commit comments

Comments
 (0)