enable tooltip for hyprland window module
This commit is contained in:
@ -59,18 +59,35 @@ auto Window::update() -> void {
|
|||||||
|
|
||||||
windowData_.title = windowName;
|
windowData_.title = windowName;
|
||||||
|
|
||||||
|
std::string label_text;
|
||||||
if (!format_.empty()) {
|
if (!format_.empty()) {
|
||||||
label_.show();
|
label_.show();
|
||||||
label_.set_markup(waybar::util::rewriteString(
|
label_text = waybar::util::rewriteString(
|
||||||
fmt::format(fmt::runtime(format_), fmt::arg("title", windowName),
|
fmt::format(fmt::runtime(format_), fmt::arg("title", windowName),
|
||||||
fmt::arg("initialTitle", windowData_.initial_title),
|
fmt::arg("initialTitle", windowData_.initial_title),
|
||||||
fmt::arg("class", windowData_.class_name),
|
fmt::arg("class", windowData_.class_name),
|
||||||
fmt::arg("initialClass", windowData_.initial_class_name)),
|
fmt::arg("initialClass", windowData_.initial_class_name)),
|
||||||
config_["rewrite"]));
|
config_["rewrite"]);
|
||||||
|
label_.set_markup(label_text);
|
||||||
} else {
|
} else {
|
||||||
label_.hide();
|
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_) {
|
if (focused_) {
|
||||||
image_.show();
|
image_.show();
|
||||||
} else {
|
} else {
|
||||||
@ -153,7 +170,6 @@ auto Window::WindowData::parse(const Json::Value& value) -> Window::WindowData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::queryActiveWorkspace() {
|
void Window::queryActiveWorkspace() {
|
||||||
|
|
||||||
std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx);
|
std::shared_lock<std::shared_mutex> windowIpcShareLock(windowIpcSmtx);
|
||||||
|
|
||||||
if (separateOutputs_) {
|
if (separateOutputs_) {
|
||||||
|
Reference in New Issue
Block a user