Waybar expands height when wlr/taskbar window title has special characters.
Hi! My Waybar height expands when I change a tab or window and its title has special characters and even with japanese/chinese alphabets, the moment i close the window or change tab it comes back to normal. It doesn't matter if button is active or not.
- Config file:
"modules-left": ["custom/start", "wlr/taskbar"]
"wlr/taskbar": {
"format": "{icon} {title:.15}",
"icon-size": "16",
"on-click": "minimize-raise",
"on-click-middle": "close",
"app_ids-mapping": {
"firefoxdeveloperedition": "firefox-developer-edition"
},
"rewrite": {
"Firefox Web Browser": "Firefox",
"foot": "Terminal"
}
}
- style.css
#taskbar button {
margin: 4px 1px;
min-width: 160px;
background-color: #3980f4;
border-color: #5a9afc #2052bb;
border-width: 2px 2px;
border-radius: 2px;
}
Normal height is set to 35 using height: 35; in config and min-height: 0; in style.css.
Expanded taskbar when I opened a window with special characters.
See #3461 for an explanation attempt, in particular the repro attempt with a minimal Gtk4 example at the bottom. The issue was for sway/workspaces, but should be similar for this. Gtk (both 3 and 4) applies resizing when certain characters are used.
I suppose somebody would have to report it there.
btw, nice styling 😄
Thanks! I tried the solution in #3461 but it didn't work, but I found the problem was the margin: 4px 1px; in #taskbar button. Only the vertical margin.
I'm trying to find a solution because I need those 4px but gtk doesn't accept setting the height or max-height. Outline only works for focus so maybe changing the font-family. I'm currently using Font Awesome for icons and Terminus.
Edit: I changed it to Tahoma (the XP's taskbar font) but no change. The only way using the font I know is setting the size to 12px which is too small. I even used padding over taskbar instead of margin in buttons but no effects on the issue.
I reported it for GTK4, since it's still happening there. https://gitlab.gnome.org/GNOME/gtk/-/issues/7555
The issue here seems to be rendering of fallback fonts. Some characters (what you called "special character") are not in the original font. GtkLabel has acquired the original font's metrics, but then needs to render the character from a different (fallback) font which may have different metrics (ascent+descent). There probably isn't an easy way for Gtk to fix this.
As a workaround, I would probably try to decide for a font size, then set buttons min-height a bit higher than the font needs, assuming the fallback font metrics are in the same ballbark, not set it to 0 for a button, but e.g. if you used a font with 14, i'd set the button min-height to maybe 20 or so.