From d6ce5af55cc11209d777d0ca1fd675e62c31f598 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Tue, 3 Mar 2026 19:18:10 +0100 Subject: [PATCH] window title width fixed --- Modules/WindowTitle.qml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Modules/WindowTitle.qml b/Modules/WindowTitle.qml index 58525d5..ddde0ae 100644 --- a/Modules/WindowTitle.qml +++ b/Modules/WindowTitle.qml @@ -11,12 +11,15 @@ Item { required property var bar property color colour: DynamicColors.palette.m3primary property Title current: text1 - readonly property int maxWidth: 300 - // readonly property int maxWidth: { - // const otherModules = bar.children.filter(c => c.id && c.item !== this && c.id !== "spacer"); - // const otherWidth = otherModules.reduce((acc, curr) => acc + (curr.item.nonAnimWidth ?? curr.width), 0); - // return bar.width - otherWidth - bar.spacing * (bar.children.length - 1) - bar.hPadding * 2; - // } + // readonly property int maxWidth: 300 + readonly property int maxWidth: { + const otherModules = bar.children.filter(c => c.enabled && c.id && c.item !== this && c.id !== "spacer"); + otherModules.forEach(m => console.log(m.id, m.item)); + const otherWidth = otherModules.reduce((acc, curr) => { + return acc + (curr.item?.nonAnimWidth ?? curr.width ?? 0); + }, 0); + return bar.width - otherWidth - bar.spacing * (bar.children.length - 1) - bar.vPadding * 2; + } required property Brightness.Monitor monitor clip: true @@ -43,6 +46,8 @@ Item { TextMetrics { id: metrics + elide: Qt.ElideRight + elideWidth: root.maxWidth font.family: "Rubik" font.pointSize: 12 text: Hypr.activeToplevel?.title ?? qsTr("Desktop")