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 don't seem to work with a custom module #3795

Closed
janemba opened this issue Nov 28, 2024 · 4 comments
Closed

Pango markup don't seem to work with a custom module #3795

janemba opened this issue Nov 28, 2024 · 4 comments

Comments

@janemba
Copy link

janemba commented Nov 28, 2024

Hello,

I've made a very custom module to display text coming from a server which is JSON formatted.

I would like to style a part of the text using pango markup but its not working.

My config file below:

    "custom/news": {
        "format": "{}",
        "exec": "$HOME/.config/waybar/scripts/newsreader.py",
        "interval": 120,
        "escape": true,
        "max-length": 120,
        "return-type": "json",
        "on-click": "xdg-open $($HOME/.config/waybar/scripts/newsreader.py --url)",
        "on-click-right": "xdg-open $($HOME/.config/waybar/scripts/newsreader.py --comments)"
    }

Basically, exec field receive the following text:

{"text": "story :: Show HN: TeaTime – distributed book library powered by SQLite, IPFS and GitHub :: 23", "tooltip": "hackernews:\n\t<span style=\"italic\">left-click: goto news\n\tright-click: goto comments</span>"}

Above, I'm trying to set in italic a part of tooltip field. However, the tooltip itself display the whole string in waybar with the span tag.

How can I make it right ?

(I'm on wayland with hyprland)

@RobertMueller2
Copy link
Contributor

Have you tried to remove "escape": true?

@janemba
Copy link
Author

janemba commented Nov 28, 2024

Yes, this is in my initial config:

    "custom/news": {
        "format": "{}",
        "exec": "$HOME/.config/waybar/scripts/newsreader.py",
        "interval": 120,
        "escape": true,
        "max-length": 120,
        "return-type": "json",
        "on-click": "xdg-open $($HOME/.config/waybar/scripts/newsreader.py --url)",
        "on-click-right": "xdg-open $($HOME/.config/waybar/scripts/newsreader.py --comments)"
    }

@RobertMueller2
Copy link
Contributor

satty-20241128-16:42:20

I meant, did you try without the highlighted line? Because with "escape" : true, the custom module first processes the output through markup_escape_text, so e.g. <span> becomes &lt;span&gt;.

@janemba
Copy link
Author

janemba commented Nov 28, 2024

Oups remove , sorry.

I just deleted it and now it works thank you.

@janemba janemba closed this as completed Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants