Fix icon spacing

This commit is contained in:
David Heinemeier Hansson committed 2026-10-04 09:10:55 -04:00
1 parent f9646299bf
commit 27a3feffc6
3 files changed
+15

No files matched your search

+13
View File
@@ -24,6 +24,8 @@ Item {
property bool useActiveColor: true
property bool maintainIndicatorReveal: false
property bool labelVisible: true
// Off for icon-font labels, whose figure metrics say nothing about the glyph.
property bool centerFigures: true
property bool hasVisualContent: text !== ""
property var revealHost: bar
property string tooltipText: ""
@@ -77,6 +79,12 @@ Item {
textFormat: Text.PlainText
visible: root.labelVisible
anchors.centerIn: parent
// Centering the line box puts the figures above the bar's middle, since
// the box keeps room for descenders. Center the figure height instead, so
// labels line up with the icons beside them.
anchors.verticalCenterOffset: !root.centerFigures || root.vertical || root.text.indexOf("\n") !== -1
? 0
: (labelMetrics.descent - labelMetrics.ascent + labelMetrics.tightBoundingRect("0").height) / 2
text: root.text
color: root.active && root.useActiveColor ? root.activeColor : root.foreground
font.family: root.fontFamily
@@ -92,6 +100,11 @@ Item {
}
}
FontMetrics {
id: labelMetrics
font: label.font
}
MouseArea {
id: mouseArea
anchors.fill: parent
+1
View File
@@ -14,6 +14,7 @@ BarWidget {
bar: root.bar
text: "\ue900"
fontFamily: "omarchy"
centerFigures: false
horizontalMargin: 7.5
onPressed: function(button) {
if (!root.bar) return
+1
View File
@@ -712,6 +712,7 @@ Panel {
id: button
anchors.fill: parent
bar: root.bar
slotSize: Style.bar.statusSlot
text: "󰇧"
tooltipText: "World clock"
onPressed: function(buttonCode) {