window title width fixed

This commit is contained in:
Zacharias-Brohn
2026-03-03 19:18:10 +01:00
parent fb1cc51eda
commit d6ce5af55c
+11 -6
View File
@@ -11,12 +11,15 @@ Item {
required property var bar required property var bar
property color colour: DynamicColors.palette.m3primary property color colour: DynamicColors.palette.m3primary
property Title current: text1 property Title current: text1
readonly property int maxWidth: 300 // readonly property int maxWidth: 300
// readonly property int maxWidth: { readonly property int maxWidth: {
// const otherModules = bar.children.filter(c => c.id && c.item !== this && c.id !== "spacer"); const otherModules = bar.children.filter(c => c.enabled && c.id && c.item !== this && c.id !== "spacer");
// const otherWidth = otherModules.reduce((acc, curr) => acc + (curr.item.nonAnimWidth ?? curr.width), 0); otherModules.forEach(m => console.log(m.id, m.item));
// return bar.width - otherWidth - bar.spacing * (bar.children.length - 1) - bar.hPadding * 2; 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 required property Brightness.Monitor monitor
clip: true clip: true
@@ -43,6 +46,8 @@ Item {
TextMetrics { TextMetrics {
id: metrics id: metrics
elide: Qt.ElideRight
elideWidth: root.maxWidth
font.family: "Rubik" font.family: "Rubik"
font.pointSize: 12 font.pointSize: 12
text: Hypr.activeToplevel?.title ?? qsTr("Desktop") text: Hypr.activeToplevel?.title ?? qsTr("Desktop")