fix: ClaudeWidget fill animation not working
The bottom-to-top fill animation on the Claude icon has three bugs that prevent it from working.
Bug 1 — iconItem has height 0
iconItem uses implicitWidth/implicitHeight instead of width/height. Inside a Row, an Item's actual size defaults to 0 even when implicitHeight is set — layouts use implicitHeight as a hint but don't assign it to height. This means fillClip.height = parent.height * pct = 0 * anything = 0, so the clip never renders.
Fix:
// before
implicitWidth: iconBg.implicitWidth
implicitHeight: iconBg.implicitHeight
// after
width: iconBg.implicitWidth
height: iconBg.implicitHeight
Bug 2 — inner Text is misaligned
The fill Text uses anchors.bottom: parent.bottom, which positions its bottom at the clip's bottom. But the Nerd Font glyph sits in the upper-middle portion of the line height, not at the very bottom — so the clipped text doesn't overlap the background icon.
Fix: use y to pin the inner Text at the same absolute position as iconBg, so both glyphs overlap perfectly and the clip cuts cleanly from the top:
// before
anchors.bottom: parent.bottom
// after
y: -(iconItem.height - fillClip.height)
Bug 3 — low percentages are invisible
Even with the above fixed, at 15–19% the fill height is only ~2–3 px of a 14 px icon, landing in empty glyph space below the circle. A minimum visible fill fixes it:
// before
height: parent.height * Math.min(rootMod.pct5h / 100, 1.0)
// after
height: rootMod.pct5h > 0 ? Math.max(parent.height * rootMod.pct5h / 100, parent.height * 0.25) : 0
All three fixes together make the animation work as intended.
Thanks for the detailed report. I verified each of the three claims against the code — Bug 3 is real and is now fixed (9015d82); Bugs 1 and 2 do not reproduce here.
Bug 3 — low percentages invisible ✅ (fixed). Correct. At low utilization (the icon was sitting at ~23%) the fill is only ~3 px and lands in the glyph’s empty lower margin, so it reads as broken. Fixed by flooring the fill at 25% of the icon height (capped at 100%).
Bug 1 — iconItem height 0 ❌ (does not reproduce). A plain Item’s width/height default to implicitWidth/implicitHeight until explicitly set — this is standard Qt behaviour, and the whole bar relies on it: every widget root sizes itself with only implicitHeight: 28 and renders fine. iconItem is therefore not 0-height, and fillClip.height is non-zero.
Bug 2 — inner Text misaligned ❌ (does not reproduce). Both glyphs are anchored bottom to the same baseline (the background Text sits at y=0 spanning the full height; the fill clip is anchored to the item bottom and its inner Text to the clip bottom). Working the nesting through, the fill glyph lands at exactly y=0..H — i.e. perfectly overlapping the background glyph. The proposed y: -(iconItem.height - fillClip.height) computes the same position, so it is effectively a no-op.
So the visible symptom you saw was Bug 3 alone. The min-fill change resolves it; the other two edits are not needed. Closing once confirmed — happy to revisit if you see the fill misalign on a specific font/DPI.