Created attachment 141210 [details] badge with 12 unread messages SUMMARY There are at least three components where this badge can be displayed: icon itself on a panel, popup on top of it WITH the window when on the same virtual desktop, and popup WITHOUT a window but with an application name when on any other virtual desktop. All three badges are round circles. But numbers such as "12" do not fit well, causing text to overflow. Interestingly, really huge numbers like "9,999" do cause a badge to stretch horizontally, and with "rounded" number such as "9" it really looks alright. STEPS TO REPRODUCE 1. Ask your friend to send you 9,999 messages on Telegram. 2. Or just include muted chats in unread count. 3. Anyhow, get yourself a big number on a badge. 4. Hover over the app's icon on a Plasma panel/task manager. OBSERVED RESULT See the screenshot. EXPECTED RESULT Badge text should have some padding. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.85.0 Qt Version: 5.15.2 Kernel Version: 5.13.13-arch1-1 (64-bit) Graphics Platform: X11 Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz Memory: 15.6 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2 ADDITIONAL INFORMATION
Created attachment 141211 [details] Badge with 9,999 unread messages
Ooh, looks like the code in the Task Manager tooltip to do this got unsynced with the code to draw it on the icon.
So both of them use the shared Badge component (good) but each one sizes it in a different way (bad). Something about the sizing code in the tooltip is wrong, compared to the sizing code in the task itself.
The issue seems to be that in the tooltip, we're forcing the badge to be displayed at the same height as the close button. This height depends on the metrics of the default font. The default font is 10pt Noto Sans, which is rather small and result sin the button being rather small, and the badge getting squeezed. It looks fine for me with 11pt Noto Sans, but this is because due to a quick or Noto Sans, 11pt is 22% bigger than 10pt which causes various buttons to be tall enough that the badge gets enough height. Not sure what the best way to fix this would be. Feel free to play with the code in https://invent.kde.org/plasma/plasma-desktop/-/blob/master/applets/taskmanager/package/contents/ui/ToolTipInstance.qml#L115 and see if you can come up with a sane solution.
> this is because due to a quick or Noto Sans, 11pt is 22% bigger than 10pt So, effectively this is a bug in a font? 😱 > Not sure what the best way to fix this would be. Feel free to play with the code in https://invent.kde.org/plasma/plasma-desktop/-/blob/master/applets/taskmanager/package/contents/ui/ToolTipInstance.qml#L115 and see if you can come up with a sane solution. Hmm… The container Item's preferred size is that of closeButton's size. But the badge itself is merely centered in it. Height is bound to standard icon size, but width is not. Why wouldn't it resize at will?
Because nothing tells it to. :) PlasmaCore.Units.iconSizes.smallMedium is fixed to 22px.