Pango Markup Not Correctly Rendered in Tooltip
HTML/Pango Markup in tooltip is not rendered correctly in waybar 0.10.2.
For example, I have a spotify module that prints this to output:
{
"text": "{icon} {artist} - {title}",
"tooltip": "<b><u>Spotify</u></b>\n{title}\n{artist} - {album}",
"class": "custom-spotify",
"alt": "spotify"
}
This is how the tooltip is rendered in v0.9.24 (Spotify ...):
However, these markup tags are ignored and print out in v0.10.2 (<b><u>Spotify<\u><\b> ...):
~~And I think this may be related to issues that calendar tooltip of the clock module is not correctly aligned when using CJK locale (e.g. https://github.com/Alexays/Waybar/issues/3132 and https://github.com/Alexays/Waybar/issues/1321#issuecomment-2027596828) since it works fine in v0.9.24.~~(just checked, not related)
I have ran a simple git bisect and found that commit https://github.com/Alexays/Waybar/commit/2673a5a4f1e2cee9f2edee57ca278697fdfdaf50 might be the reason.
Have you checked whether this is still happening with 0.10.3? I'm thinking a453ea3c70195803e9962a97f9243c0c78d4ecdc might have fixed it, which is included in 0.10.3.
Nope, still <b><u>Spotify<\u><\b>, tried both v0.10.3 (from Arch Linux Packages) and the latest commit (https://github.com/Alexays/Waybar/commit/99971556178ae504b7ba7ab559952f781925f7da)
OK, it works for me. I'm using a limited repro.
{
"layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height" : 50,
"modules-center": ["custom/test-output"],
"custom/test-output": {
"format": "{}",
"exec": "/home/user/tmp/waybar-test-config/test-output3.sh",
"return-type":"json",
"interval": 1,
},
}
window {
background-color: transparent;
}
#custom-test-output {
color: #ffffff;
background-color: #ff0000;
}
#!/bin/sh
TEXT=" Moguai - Freaks"
TOOLTIP="<b><u>Spotify</u></b>\nMoguai\nFreaks"
CLASS="custom-spotify"
ALT="spotify"
printf '{"text": "%s", "tooltip": "%s", "class" : "%s", "alt" : "%s"}\n' "$TEXT" "$TOOLTIP" "$CLASS" "$ALT"
Could you kindly share your config?
Found a small problem in my config, I accidentally add "escape": true in the module.
Thx for you time.
No problem, that explains it :) good to hear it's working now.
Sorry to reopen this, but I just encounter the same issue when I migrate this custom spotify widget into mpris one.
"mpris": {
"interval": 1,
"format": "{status_icon} {artist} - {title}",
"format-stopped": "",
"tooltip-format": "<b>{player}</b>\n{title} {position}/{length}\n{artist} - {album}",
"tooltip-format-stopped": "",
"status-icons": {
"playing": "",
"paused": "",
"stopped": "",
},
},
This happens on both waybar v0.10.3 (from Arch Linus Packages) and the latest commit https://github.com/Alexays/Waybar/commit/15e1547661bfc5fe9b3d45bb0d9cea11cf07db7f .
@RobertMueller2 Can you reproduce this?
Yes. Mpris is using set_tooltip_text rather than set_tooltip_markup.
https://github.com/Alexays/Waybar/blob/15e1547661bfc5fe9b3d45bb0d9cea11cf07db7f/src/modules/mpris/mpris.cpp#L726
Somebody would have to change that. That doesn't look difficult for the mpris module. And then the next issue is about the taskbar module, or the battery module, or.... ;)
The challenge here is to do it as centrally as possible, perhaps in AModule, and then achieve a sensible result for all 44 places in the modules that set a tooltip. They might even have different config options for formatting, which could break existing configs. The tooltip content generation has to remain within the modules, because that's very specific, but whether markup is used or text could be in AModule based on a config option.