diff --git a/shell/Ui/WidgetButton.qml b/shell/Ui/WidgetButton.qml index 20c27acd..107fcac6 100644 --- a/shell/Ui/WidgetButton.qml +++ b/shell/Ui/WidgetButton.qml @@ -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 diff --git a/shell/plugins/menu/BarWidget.qml b/shell/plugins/menu/BarWidget.qml index 8fa7e1b3..61e5e804 100644 --- a/shell/plugins/menu/BarWidget.qml +++ b/shell/plugins/menu/BarWidget.qml @@ -14,6 +14,7 @@ BarWidget { bar: root.bar text: "\ue900" fontFamily: "omarchy" + centerFigures: false horizontalMargin: 7.5 onPressed: function(button) { if (!root.bar) return diff --git a/shell/plugins/panels/elsewhen/Panel.qml b/shell/plugins/panels/elsewhen/Panel.qml index 238b50d8..72ee1abd 100644 --- a/shell/plugins/panels/elsewhen/Panel.qml +++ b/shell/plugins/panels/elsewhen/Panel.qml @@ -712,6 +712,7 @@ Panel { id: button anchors.fill: parent bar: root.bar + slotSize: Style.bar.statusSlot text: "󰇧" tooltipText: "World clock" onPressed: function(buttonCode) {