applets/taskmanager: choose better badge size on vertical panel
The badge size on the task manager is based on the height of the task manager button; more specifically it is set to have a height of 40 % of the button's height. This generally works very well, but fails in some configurations on vertical panels with IOTM: if the icon spacing is changed, it will affect the height rather than the width of the button (as with a horizontal IOTM), and thus also scale the badge, making the label unreasonably large with large spacing. On a very thin, small spacing panel on the other hand, the label may become unreadably tiny
This change makes the label size for a vertical IOTM depend on width (50%, with a minimum of 0.7 and maximum of 1.5 gridUnits). For narrow side panels, this yields a similar size to the IOTM badge on a default panel (slightly smaller to accomodate a larger label) and gives a reasonable result on thicker and ultrawide panels; large but not excessively huge.
before | after | |
---|---|---|
small, ~30px | ||
medium, ~30px | ||
large, ~30px | ||
small, ~48px | ||
large, ~48px | ||
200px chonker |
(It's a bit hard to see from a screenshot just how tiny the badges are on the 30px small version are... it's really hard to read, and practically useless. I also recommend trying it out, as the effect is very different depending on the exact panel size and similar factors)
I tried a couple of other approaches, but found that they break in different circumstances and look just wrong on different panel configurations. This is also not optimal; the icon is mostly covered if (like neochat) it has almost nothing in the lower portion and the panel is very thin and with small spacing; and with very high numbers it won't fit thin panels. I think if we show the badges they should be readable, and the second problem is probably not fixable; no matter what, "9,999+" is not going to fit into 20 pixels. (Maybe the number doesn't need to go quite as high, but I think that should be a separate MR).