diff options
Diffstat (limited to 'modules/bar/components/ActiveWindow.qml')
| -rw-r--r-- | modules/bar/components/ActiveWindow.qml | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/modules/bar/components/ActiveWindow.qml b/modules/bar/components/ActiveWindow.qml index 17bc6a7..6ac4b89 100644 --- a/modules/bar/components/ActiveWindow.qml +++ b/modules/bar/components/ActiveWindow.qml @@ -9,7 +9,6 @@ import QtQuick Item { id: root - readonly property bool vertical: parent?.vertical ?? false property color colour: Colours.palette.m3primary implicitWidth: child.implicitWidth @@ -18,13 +17,11 @@ Item { Item { id: child - readonly property bool vertical: root.vertical - anchors.centerIn: parent clip: true - implicitWidth: root.vertical ? Math.max(icon.implicitWidth, text.implicitHeight) : icon.implicitWidth + text.implicitWidth + text.anchors.leftMargin - implicitHeight: root.vertical ? icon.implicitHeight + text.implicitWidth + text.anchors.topMargin : Math.max(icon.implicitHeight, text.implicitheight) + implicitWidth: Math.max(icon.implicitWidth, text.implicitHeight) + implicitHeight: icon.implicitHeight + text.implicitWidth + text.anchors.topMargin MaterialIcon { id: icon @@ -33,13 +30,15 @@ Item { text: Icons.getAppCategoryIcon(Hyprland.activeClient?.wmClass, "desktop_windows") color: root.colour - anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined + anchors.horizontalCenter: parent.horizontalCenter } - AnchorText { + StyledText { id: text - prevAnchor: icon + anchors.horizontalCenter: icon.horizontalCenter + anchors.top: icon.bottom + anchors.topMargin: Appearance.spacing.small text: metrics.elidedText font.pointSize: metrics.font.pointSize @@ -47,13 +46,13 @@ Item { color: root.colour transform: Rotation { - angle: vertical ? 90 : 0 + angle: 90 origin.x: text.implicitHeight / 2 origin.y: text.implicitHeight / 2 } - width: vertical ? implicitHeight : implicitWidth - height: vertical ? implicitWidth : implicitHeight + width: implicitHeight + height: implicitWidth } TextMetrics { @@ -63,7 +62,7 @@ Item { font.pointSize: Appearance.font.size.smaller font.family: Appearance.font.family.mono elide: Qt.ElideRight - elideWidth: root.vertical ? root.height - icon.height : root.width - icon.width + elideWidth: root.height - icon.height } Behavior on implicitWidth { |