diff --git a/containment/package/contents/ui/applet/ShortcutBadge.qml b/containment/package/contents/ui/applet/ShortcutBadge.qml --- a/containment/package/contents/ui/applet/ShortcutBadge.qml +++ b/containment/package/contents/ui/applet/ShortcutBadge.qml @@ -97,10 +97,14 @@ LatteComponents.BadgeText { id: appletNumber - anchors.top: parent.top - anchors.left: parent.left - //anchors.centerIn: parent + // when iconSize < 48, height is always = 24, height / iconSize > 50% + // we prefer center aligned badges to top-left aligned ones + property bool centerInParent: root.iconSize < 48 + + anchors.left: centerInParent? undefined : parent.left + anchors.top: centerInParent? undefined : parent.top + anchors.centerIn: centerInParent? parent : undefined minimumWidth: 0.4 * (wrapper.zoomScale * root.iconSize) height: Math.max(24, 0.4 * (wrapper.zoomScale * root.iconSize)) diff --git a/plasmoid/package/contents/ui/task/ShortcutBadge.qml b/plasmoid/package/contents/ui/task/ShortcutBadge.qml --- a/plasmoid/package/contents/ui/task/ShortcutBadge.qml +++ b/plasmoid/package/contents/ui/task/ShortcutBadge.qml @@ -58,9 +58,14 @@ LatteComponents.BadgeText { id: taskNumber - anchors.left: parent.left - anchors.top: parent.top - //anchors.centerIn: parent + + // when iconSize < 48, height is always = 24, height / iconSize > 50% + // we prefer center aligned badges to top-left aligned ones + property bool centerInParent: root.iconSize < 48 + + anchors.left: centerInParent? undefined : parent.left + anchors.top: centerInParent? undefined : parent.top + anchors.centerIn: centerInParent? parent : undefined minimumWidth: 0.4 * (wrapper.mScale * root.iconSize) height: Math.max(24, 0.4 * (wrapper.mScale * root.iconSize))