summaryrefslogtreecommitdiff
path: root/bar/ActiveWindow.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-01 19:08:29 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-01 19:08:29 +0800
commit05fa3647d355fb4e0798fff1225663b41290f4e8 (patch)
tree8d141b782ab0b2a12742caccd0e054ecf0b98580 /bar/ActiveWindow.qml
parent073f07da5d326546a889ad4990c983a6ab783cee (diff)
fix(ActiveWindow): properly resize text when space is unavaliable
Diffstat (limited to 'bar/ActiveWindow.qml')
-rw-r--r--bar/ActiveWindow.qml32
1 files changed, 21 insertions, 11 deletions
diff --git a/bar/ActiveWindow.qml b/bar/ActiveWindow.qml
index 0dc1bde..db69e3e 100644
--- a/bar/ActiveWindow.qml
+++ b/bar/ActiveWindow.qml
@@ -40,6 +40,7 @@ IRect {
id: rowLayout
anchors.centerIn: parent
spacing: Bar.resourceIconTextSpacing
+ width: Math.min(implicitWidth, root.width)
IconImage {
id: icon
@@ -56,16 +57,25 @@ IRect {
}
}
- IText {
- animate: true
- font.pixelSize: General.fontSize
- text: strip(root?.toplevel?.title) || ""
-
- // sync animation
- opacity: root.activated ? 1 : 0
- Behavior on opacity {
- NumberAnimation {
- duration: General.animationDuration / 4
+ Item {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ implicitWidth: childrenRect.width
+ IText {
+ anchors.verticalCenter: parent.verticalCenter
+ width: Math.min(implicitWidth, rowLayout.width - icon.implicitWidth)
+ animate: true
+ clip: true
+ elide: Text.ElideRight
+ font.pixelSize: General.fontSize
+ text: strip(root?.toplevel?.title) || ""
+
+ // sync animation
+ opacity: root.activated ? 1 : 0
+ Behavior on opacity {
+ NumberAnimation {
+ duration: General.animationDuration / 4
+ }
}
}
}
@@ -79,7 +89,7 @@ IRect {
}
}
- Behavior on implicitWidth {
+ Behavior on width {
ISpringAnimation {
spring: General.springAnimationSpring * 2
damping: General.springAnimationDamping * 1.3