Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pango Markup Not Correctly Rendered in Tooltip #3375

Open
Fr4nk1inCs opened this issue Jun 20, 2024 · 8 comments · May be fixed by #3460
Open

Pango Markup Not Correctly Rendered in Tooltip #3375

Fr4nk1inCs opened this issue Jun 20, 2024 · 8 comments · May be fixed by #3460
Labels
bug Something isn't working clock custom inhibitor

Comments

@Fr4nk1inCs
Copy link

Fr4nk1inCs commented Jun 20, 2024

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 ...):
rect3

However, these markup tags are ignored and print out in v0.10.2 (<b><u>Spotify<\u><\b> ...):
rect1

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. #3132 and #1321 (comment)) since it works fine in v0.9.24.(just checked, not related)

@github-actions github-actions bot added bug Something isn't working clock custom inhibitor labels Jun 20, 2024
@Fr4nk1inCs
Copy link
Author

I have ran a simple git bisect and found that commit 2673a5a might be the reason.

@RobertMueller2
Copy link
Contributor

Have you checked whether this is still happening with 0.10.3? I'm thinking a453ea3 might have fixed it, which is included in 0.10.3.

@Fr4nk1inCs
Copy link
Author

Nope, still <b><u>Spotify<\u><\b>, tried both v0.10.3 (from Arch Linux Packages) and the latest commit (9997155)

@RobertMueller2
Copy link
Contributor

OK, it works for me. I'm using a limited repro.

satty-20240701-17:14:07

{
    "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?

@Fr4nk1inCs
Copy link
Author

Found a small problem in my config, I accidentally add "escape": true in the module.

Thx for you time.

@RobertMueller2
Copy link
Contributor

No problem, that explains it :) good to hear it's working now.

@Fr4nk1inCs
Copy link
Author

Fr4nk1inCs commented Jul 17, 2024

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": "",
  },
},

rect1

This happens on both waybar v0.10.3 (from Arch Linus Packages) and the latest commit 15e1547 .

@RobertMueller2 Can you reproduce this?

@Fr4nk1inCs Fr4nk1inCs reopened this Jul 17, 2024
@RobertMueller2
Copy link
Contributor

Yes. Mpris is using set_tooltip_text rather than set_tooltip_markup.

label_.set_tooltip_text(tooltip_text);

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clock custom inhibitor
Projects
None yet
2 participants