Skip to content

Commit

Permalink
enable tooltip for hyprland window module
Browse files Browse the repository at this point in the history
  • Loading branch information
Duckulus committed Jan 22, 2025
1 parent a4241d7 commit ba12ca7
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/modules/hyprland/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,35 @@ auto Window::update() -> void {

windowData_.title = windowName;

std::string label_text;
if (!format_.empty()) {
label_.show();
label_.set_markup(waybar::util::rewriteString(
label_text = waybar::util::rewriteString(
fmt::format(fmt::runtime(format_), fmt::arg("title", windowName),
fmt::arg("initialTitle", windowData_.initial_title),
fmt::arg("class", windowData_.class_name),
fmt::arg("initialClass", windowData_.initial_class_name)),
config_["rewrite"]));
config_["rewrite"]);
label_.set_markup(label_text);
} else {
label_.hide();
}

if (tooltipEnabled()) {
std::string tooltip_format;
if (config_["tooltip-format"].isString()) {
tooltip_format = config_["tooltip-format"].asString();
}
if (!tooltip_format.empty()) {
label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format), fmt::arg("title", windowName),
fmt::arg("initialTitle", windowData_.initial_title),
fmt::arg("class", windowData_.class_name),
fmt::arg("initialClass", windowData_.initial_class_name)));
} else if (!label_text.empty()){
label_.set_tooltip_text(label_text);
}
}

if (focused_) {
image_.show();
} else {
Expand Down Expand Up @@ -153,7 +170,6 @@ auto Window::WindowData::parse(const Json::Value& value) -> Window::WindowData {
}

void Window::queryActiveWorkspace() {

std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx);

if (separateOutputs_) {
Expand Down

0 comments on commit ba12ca7

Please sign in to comment.